2019-06-21 13:30:37 +08:00
|
|
|
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: {
|
2019-06-23 15:47:39 +08:00
|
|
|
path: path.resolve(__dirname, '..', 'doc', 'dist'),
|
2019-06-21 13:30:37 +08:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}),
|
2019-06-24 16:24:05 +08:00
|
|
|
new ExtractTextPlugin('[name].[hash:7].css')
|
2019-06-21 13:30:37 +08:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = webpackConfig
|