2019-06-28 15:58:33 +08:00
|
|
|
/**
|
|
|
|
* Webpack config under development
|
|
|
|
*/
|
2019-05-29 17:49:01 +08:00
|
|
|
const path = require('path')
|
|
|
|
const webpack = require('webpack')
|
|
|
|
const config = require('./config')
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
2019-06-04 11:30:56 +08:00
|
|
|
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
2019-05-29 17:49:01 +08:00
|
|
|
|
|
|
|
const webpackConfig = {
|
|
|
|
mode: 'development',
|
|
|
|
entry: './demo/index.js',
|
|
|
|
output: {
|
2019-06-04 11:30:56 +08:00
|
|
|
path: path.resolve(process.cwd()),
|
2019-05-29 17:49:01 +08:00
|
|
|
publicPath: '',
|
|
|
|
filename: '[name].[hash:7].js',
|
|
|
|
chunkFilename: '[name].[hash:7].js'
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.vue', '.json'],
|
|
|
|
alias: config.alias,
|
|
|
|
modules: ['node_modules']
|
|
|
|
},
|
|
|
|
devServer: {
|
|
|
|
host: '0.0.0.0',
|
|
|
|
port: 8086,
|
|
|
|
publicPath: '/',
|
|
|
|
hot: true
|
|
|
|
},
|
|
|
|
performance: {
|
|
|
|
hints: false
|
|
|
|
},
|
|
|
|
stats: {
|
|
|
|
children: false
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
2019-09-17 19:24:39 +08:00
|
|
|
{
|
2019-09-21 17:03:37 +08:00
|
|
|
test: /index\.md$/,
|
|
|
|
loader: ['vue-loader', path.resolve(__dirname, '../marked/NaiveUIDocLoader.js')]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: {
|
|
|
|
test: /\.md$/,
|
|
|
|
exclude: /index\.md$/
|
|
|
|
},
|
2019-09-17 19:24:39 +08:00
|
|
|
loader: ['vue-loader', path.resolve(__dirname, '../marked/NaiveUIMdLoader.js')]
|
|
|
|
},
|
2019-05-29 17:49:01 +08:00
|
|
|
{
|
2019-07-17 18:27:13 +08:00
|
|
|
test: /\.demo\.vue$/,
|
|
|
|
loader: ['vue-loader', path.resolve(__dirname, '../doc/NaiveUIDemoLoader.js')]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: {
|
|
|
|
test: /\.vue$/,
|
|
|
|
exclude: /\.demo\.vue$/
|
|
|
|
},
|
2019-05-29 17:49:01 +08:00
|
|
|
loader: 'vue-loader',
|
|
|
|
options: {
|
|
|
|
compilerOptions: {
|
|
|
|
preserveWhitespace: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-06-26 20:16:11 +08:00
|
|
|
{
|
|
|
|
test: /\.(js|jsx)$/,
|
|
|
|
exclude: [/node_modules/],
|
|
|
|
loader: 'babel-loader'
|
|
|
|
},
|
2019-05-29 17:49:01 +08:00
|
|
|
{
|
|
|
|
test: /\.(scss|css)$/,
|
2019-06-26 20:16:11 +08:00
|
|
|
use: ['style-loader', 'css-loader', 'sass-loader']
|
2019-05-29 17:49:01 +08:00
|
|
|
},
|
2019-06-04 11:30:56 +08:00
|
|
|
{
|
2019-05-29 17:49:01 +08:00
|
|
|
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]')
|
|
|
|
}
|
2019-09-23 11:32:50 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
resourceQuery: /blockType=i18n/,
|
|
|
|
type: 'javascript/auto',
|
|
|
|
loader: '@kazupon/vue-i18n-loader'
|
2019-05-29 17:49:01 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: './demo/index.tpl',
|
|
|
|
filename: './index.html'
|
|
|
|
}),
|
|
|
|
new VueLoaderPlugin(),
|
|
|
|
new webpack.LoaderOptionsPlugin({
|
|
|
|
vue: {
|
|
|
|
compilerOptions: {
|
|
|
|
preserveWhitespace: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2019-06-04 11:30:56 +08:00
|
|
|
module.exports = webpackConfig
|