naive-ui/build/webpack.private-doc.js

113 lines
2.6 KiB
JavaScript
Raw Normal View History

2019-09-04 21:56:58 +08:00
/**
* Webpack config to pack documentation page
*/
const path = require('path')
const webpack = require('webpack')
const config = require('./config')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const webpackConfig = {
mode: 'development',
entry: './demo/privateIndex.js',
output: {
path: path.resolve(__dirname, '..', 'doc', 'dist'),
publicPath: '',
filename: '[name].[hash:7].js',
chunkFilename: '[name].[hash:7].js'
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: config.alias,
modules: ['node_modules']
},
performance: {
hints: false
},
stats: {
children: false
},
module: {
rules: [
2019-09-17 23:42:03 +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 23:42:03 +08:00
loader: ['vue-loader', path.resolve(__dirname, '../marked/NaiveUIMdLoader.js')]
},
2019-09-04 21:56:58 +08:00
{
test: /\.demo\.vue$/,
loader: ['vue-loader', path.resolve(__dirname, '../doc/NaiveUIDemoLoader.js')]
},
{
test: {
test: /\.vue$/,
exclude: /\.demo\.vue$/
},
loader: 'vue-loader',
options: {
compilerOptions: {
preserveWhitespace: false
}
}
},
{
test: /\.(js|jsx)$/,
exclude: [/node_modules/],
loader: 'babel-loader'
},
// {
// test: /\.(scss|css)$/,
// use: [
// 'style-loader',
// 'css-loader',
// 'sass-loader'
// ]
// },
{
test: /\.(scss|css)$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['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]')
}
2019-09-23 11:32:50 +08:00
},
{
resourceQuery: /blockType=i18n/,
type: 'javascript/auto',
loader: '@kazupon/vue-i18n-loader'
2019-09-04 21:56:58 +08:00
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './demo/index.tpl',
filename: './index.html'
}),
new VueLoaderPlugin(),
new webpack.LoaderOptionsPlugin({
vue: {
compilerOptions: {
preserveWhitespace: false
}
}
}),
new ExtractTextPlugin('[name].[hash:7].css')
]
}
module.exports = webpackConfig