naive-ui/build/webpack.release.js

78 lines
1.7 KiB
JavaScript
Raw Normal View History

2019-06-28 15:58:33 +08:00
/**
* Webpack config to test if there is any problem in index.js before release
*/
2019-06-14 10:59:06 +08:00
const path = require('path')
const webpack = require('webpack')
const config = require('./config')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
2019-10-25 12:48:10 +08:00
const glob = require('glob')
const entry = {}
glob.sync('./packages/icons/*.vue').concat('./index.js').forEach(filePath => {
const entryName = filePath.replace(/^\.\/packages\//, '').replace(/\.(vue|js)$/, '')
entry[entryName] = filePath
})
2019-06-14 10:59:06 +08:00
const webpackConfig = {
mode: 'development',
2019-10-25 12:48:10 +08:00
entry,
2019-06-14 10:59:06 +08:00
output: {
2019-10-25 12:48:10 +08:00
path: path.resolve(process.cwd(), 'lib'),
// publicPath: '',
filename: '[name].js'
// chunkFilename: '[name].js'
2019-06-14 10:59:06 +08:00
},
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: /\.(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(),
new webpack.LoaderOptionsPlugin({
vue: {
compilerOptions: {
preserveWhitespace: false
}
}
})
]
}
module.exports = webpackConfig