mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-05 05:38:24 +08:00
54eeb5ced3
* Chore: convert build system to webpack * Update webpack.demo.js * Chore: remove cooking and upgrade dependencies to adapt webpack@3
99 lines
2.2 KiB
JavaScript
99 lines
2.2 KiB
JavaScript
const path = require('path');
|
|
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
|
|
|
const config = require('./config');
|
|
|
|
const webpackConfig = {
|
|
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']
|
|
},
|
|
devtool: '#inline-source-map',
|
|
module: {
|
|
rules: [
|
|
{
|
|
enforce: 'post',
|
|
test: /\.jsx?$/,
|
|
loader: 'isparta-loader',
|
|
options: { esModules: true },
|
|
exclude: config.jsexclude,
|
|
include: /src|packages/
|
|
},
|
|
{
|
|
test: /\.(jsx?|babel|es6)$/,
|
|
include: process.cwd(),
|
|
exclude: config.jsexclude,
|
|
loader: 'babel-loader'
|
|
},
|
|
{
|
|
test: /\.vue$/,
|
|
loader: 'vue-loader',
|
|
options: {
|
|
loaders: {
|
|
js: process.env.CI_ENV ? 'isparta-loader' : 'isparta-loader!eslint-loader'
|
|
},
|
|
preserveWhitespace: false
|
|
}
|
|
},
|
|
{
|
|
test: /\.json$/,
|
|
loader: 'json-loader'
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
loaders: ['style-loader', 'css-loader', 'postcss-loader']
|
|
},
|
|
{
|
|
test: /\.html$/,
|
|
loader: 'html-loader?minimize=false'
|
|
},
|
|
{
|
|
test: /\.otf|ttf|woff2?|eot(\?\S*)?$/,
|
|
loader: 'url-loader',
|
|
query: {
|
|
limit: 10000,
|
|
name: path.posix.join('static', '[name].[hash:7].[ext]')
|
|
}
|
|
},
|
|
{
|
|
test: /\.svg(\?\S*)?$/,
|
|
loader: 'url-loader',
|
|
query: {
|
|
limit: 10000,
|
|
name: path.posix.join('static', '[name].[hash:7].[ext]')
|
|
}
|
|
},
|
|
{
|
|
test: /\.(gif|png|jpe?g)(\?\S*)?$/,
|
|
loader: 'url-loader',
|
|
query: {
|
|
limit: 10000,
|
|
name: path.posix.join('static', '[name].[hash:7].[ext]')
|
|
}
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
]
|
|
};
|
|
|
|
if (!process.env.CI_ENV) {
|
|
webpackConfig.plugins.push(
|
|
new ProgressBarPlugin()
|
|
);
|
|
}
|
|
|
|
module.exports = webpackConfig;
|