forked from BinarCode/vue-form-wizard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.build.config.js
116 lines (107 loc) · 2.55 KB
/
webpack.build.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
/* eslint-disable no-mixed-spaces-and-tabs */
/* eslint-disable no-tabs */
var webpack = require('webpack')
var path = require('path')
// var version = require("./package.json").version;
// var banner = "/**\n" + " * vue-form-generator v" + version + "\n" + " * https://github.com/icebob/vue-form-generator\n" + " * Released under the MIT License.\n" + " */\n";
var MiniCssExtractPlugin = require('mini-css-extract-plugin')
// var ExtractTextPlugin = require('extract-text-webpack-plugin')
var StatsPlugin = require('stats-webpack-plugin')
const { VueLoaderPlugin } = require('vue-loader')
const devMode = process.env.NODE_ENV !== 'production'
var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
var loaders = [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { targets: 'defaults' }]
]
}
}
},
{
test: /\.css$/i,
use: [
'vue-style-loader',
{
loader: MiniCssExtractPlugin.loader
},
'css-loader'
]
},
{
test: /\.scss$/,
use: [
{
loader: MiniCssExtractPlugin.loader
},
'css-loader',
'sass-loader'
]
},
{
test: /\.s[ac]ss$/i,
use: [
'css-loader',
{
loader: 'sass-loader',
options: {
webpackImporter: false,
sassOptions: {
outputStyle: 'compressed',
indentedSyntax: false,
includePaths: ['src/assets', 'src/assets/form-wizard']
},
implementation: require('sass')
}
}
]
},
{
test: /\.vue?$/,
use: [
'vue-loader'
// Translates CSS into CommonJS
]
}
]
module.exports = [
{
entry: './src/index.js',
mode: 'production',
output: {
path: path.resolve(__dirname, './dist'),
filename: 'vue-form-wizard.js',
library: 'VueFormWizard',
libraryTarget: 'umd'
},
optimization: {
moduleIds: 'named'
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
/* new webpack.BannerPlugin(banner, {
raw: true
}), */
new VueLoaderPlugin(),
new MiniCssExtractPlugin({ filename: 'vue-form-wizard.mine.css', chunkFilename: '[id].css' }),
new StatsPlugin({filename: './stats.json',
chunkModules: true
// exclude: [/node_modules[\\\/]react/]
})
],
module: {
rules: loaders
}
}
]