naive-ui/build/webpack.test.js
2020-03-04 03:01:15 +08:00

72 lines
1.5 KiB
JavaScript

/**
* Webpack config for unit test
*/
const path = require('path')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const config = require('./config')
const env = process.env.NODE_ENV
const webpackConfig = {
mode: env === 'production' ? 'production' : '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: config.alias,
modules: ['node_modules']
},
module: {
rules: [
{
test: /\.(jsx?|babel|es6)$/,
include: process.cwd(),
exclude: /node_modules|utils\/popper\.js|utils\/date\.js/,
loader: 'babel-loader'
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
compilerOptions: {
preserveWhitespace: false
}
}
},
{
test: /\.(scss|css)$/,
use: [
'style-loader',
'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 VueLoaderPlugin()
]
}
// if (!process.env.CI_ENV) {
// webpackConfig.plugins.push(
// new ProgressBarPlugin()
// );
// }
module.exports = webpackConfig