PicList/.electron-vue/webpack.docs.config.js

121 lines
2.7 KiB
JavaScript
Raw Normal View History

2017-12-11 08:52:14 -05:00
const HtmlWebpackPlugin = require('html-webpack-plugin')
2018-12-27 22:10:28 -05:00
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
2017-12-11 08:52:14 -05:00
const path = require('path')
2018-12-27 22:10:28 -05:00
const { VueLoaderPlugin } = require('vue-loader')
const webpack = require('webpack')
2017-12-11 08:52:14 -05:00
module.exports = {
2018-12-27 22:10:28 -05:00
mode: 'development',
2017-12-11 08:52:14 -05:00
context: path.resolve(__dirname, '../docs'),
entry: './main.js',
output: {
path: path.resolve(__dirname, '../docs/dist'),
filename: "index.js"
},
resolve: {
alias: {
'icons': path.resolve(__dirname, '../build/icons')
}
},
module: {
rules: [
{
test: /\.(js|vue)$/,
enforce: 'pre',
exclude: /node_modules/,
use: {
loader: 'eslint-loader',
options: {
formatter: require('eslint-friendly-formatter')
}
}
},
2018-12-27 22:10:28 -05:00
{
test: /\.styl(us)?$/,
use: [
'vue-style-loader',
'css-loader',
'stylus-loader'
]
},
{
test: /\.pug$/, loader: "pug-plain-loader"
},
2017-12-11 08:52:14 -05:00
{
test: /\.css$/,
2018-12-27 22:10:28 -05:00
use: ['vue-style-loader', 'css-loader']
2017-12-11 08:52:14 -05:00
},
{
test: /\.html$/,
use: 'vue-html-loader'
},
{
test: /\.js$/,
use: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.node$/,
use: 'node-loader'
},
{
test: /\.vue$/,
use: {
loader: 'vue-loader',
}
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use: {
loader: 'url-loader',
query: {
limit: 10000,
name: 'imgs/[name]--[folder].[ext]'
}
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: 'media/[name]--[folder].[ext]'
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: {
loader: 'url-loader',
query: {
limit: 10000,
name: 'fonts/[name]--[folder].[ext]'
}
}
}
]
},
plugins: [
2018-12-27 22:10:28 -05:00
new VueLoaderPlugin(),
2017-12-11 08:52:14 -05:00
new HtmlWebpackPlugin({
template: path.resolve(__dirname, '../docs/template.html')
}),
2018-12-27 22:10:28 -05:00
new MiniCssExtractPlugin({filename: 'styles.css'}),
2017-12-11 08:52:14 -05:00
]
}
if (process.env.NODE_ENV === 'production') {
// module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
2018-12-27 22:10:28 -05:00
module.exports.mode = 'production'
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}