mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-04-06 14:30:46 +08:00
feat: build doc by webpack
This commit is contained in:
parent
7a40ef490b
commit
9470c3df7a
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
node_modules
|
||||
dist
|
||||
demoDist
|
||||
docDist
|
||||
test/unit/coverage
|
81
build/webpack.doc.js
Normal file
81
build/webpack.doc.js
Normal file
@ -0,0 +1,81 @@
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const config = require('./config')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
|
||||
const webpackConfig = {
|
||||
mode: 'development',
|
||||
entry: './demo/index.js',
|
||||
output: {
|
||||
path: path.resolve(process.cwd(), 'docDist'),
|
||||
publicPath: '',
|
||||
filename: '[name].[hash:7].js',
|
||||
chunkFilename: '[name].[hash:7].js'
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.vue', '.json'],
|
||||
alias: config.alias,
|
||||
modules: ['node_modules']
|
||||
},
|
||||
performance: {
|
||||
hints: false
|
||||
},
|
||||
stats: {
|
||||
children: false
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
compilerOptions: {
|
||||
preserveWhitespace: false
|
||||
}
|
||||
}
|
||||
},
|
||||
// {
|
||||
// test: /\.(scss|css)$/,
|
||||
// use: [
|
||||
// 'style-loader',
|
||||
// 'css-loader',
|
||||
// 'sass-loader'
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
test: /\.(scss|css)$/,
|
||||
use: ExtractTextPlugin.extract({
|
||||
fallback: 'style-loader',
|
||||
use: ['css-loader', 'sass-loader']
|
||||
})
|
||||
},
|
||||
{
|
||||
test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/,
|
||||
loader: 'url-loader',
|
||||
query: {
|
||||
limit: 10000,
|
||||
name: path.posix.join('static', '[name].[hash:7].[ext]')
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: './demo/index.tpl',
|
||||
filename: './index.html'
|
||||
}),
|
||||
new VueLoaderPlugin(),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
vue: {
|
||||
compilerOptions: {
|
||||
preserveWhitespace: false
|
||||
}
|
||||
}
|
||||
}),
|
||||
new ExtractTextPlugin('style.css')
|
||||
]
|
||||
}
|
||||
|
||||
module.exports = webpackConfig
|
@ -9,7 +9,8 @@
|
||||
"dev": "cross-env NODE_ENV=development webpack-dev-server --config build/webpack.dev.js",
|
||||
"serve": "npm run dev",
|
||||
"test": "cross-env NODE_ENV=development BABEL_ENV=test karma start test/unit/karma.conf.js",
|
||||
"test-release": "cross-env NODE_ENV=production webpack-dev-server --config build/webpack.release.js"
|
||||
"test-release": "cross-env NODE_ENV=production webpack-dev-server --config build/webpack.release.js",
|
||||
"build-doc": "cross-env NODE_ENV=development & rm -rf docDist & webpack --config build/webpack.doc.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
@ -31,6 +32,7 @@
|
||||
"css-loader": "^2.1.1",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-vue": "^5.2.2",
|
||||
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
||||
"file-loader": "^3.0.1",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-autoprefixer": "^6.1.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user