mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-11-30 03:07:36 +08:00
2604c6192f
* remove unsed dev dependencies * chore: use latest css loaders & fix error * remove postcss-nesting * chore: remove postcss-loader * upgrade copy-webpack-plugin
68 lines
1.4 KiB
JavaScript
68 lines
1.4 KiB
JavaScript
const path = require('path');
|
|
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
|
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
|
|
|
const config = require('./config');
|
|
|
|
const webpackConfig = {
|
|
mode: 'development',
|
|
entry: {
|
|
app: ['./src/index.js']
|
|
},
|
|
output: {
|
|
path: path.resolve(process.cwd(), './dist'),
|
|
publicPath: '/dist/',
|
|
filename: '[name].js',
|
|
chunkFilename: '[id].js'
|
|
},
|
|
resolve: {
|
|
extensions: ['.js', '.vue', '.json'],
|
|
alias: Object.assign(config.alias, {
|
|
'vue$': 'vue/dist/vue.common.js'
|
|
}),
|
|
modules: ['node_modules']
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(jsx?|babel|es6)$/,
|
|
include: process.cwd(),
|
|
exclude: config.jsexclude,
|
|
loader: 'babel-loader'
|
|
},
|
|
{
|
|
test: /\.vue$/,
|
|
loader: 'vue-loader',
|
|
options: {
|
|
compilerOptions: {
|
|
preserveWhitespace: false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
loaders: ['style-loader', 'css-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 VueLoaderPlugin()
|
|
]
|
|
};
|
|
|
|
if (!process.env.CI_ENV) {
|
|
webpackConfig.plugins.push(
|
|
new ProgressBarPlugin()
|
|
);
|
|
}
|
|
|
|
module.exports = webpackConfig;
|