-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
131 lines (125 loc) · 4.29 KB
/
webpack.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
entry: {
index1: './src/js/index1.js',
index2: './src/js/index2.js',
index3: './src/js/index3.js',
docpage: './src/js/docpage.js'
},
// Path and filename of your result bundle.
// Webpack will bundle all JavaScript into this file
plugins: [
new MiniCssExtractPlugin({
filename: "css/[name].css"
}),
new HtmlWebpackPlugin({
chunks: ['index1'],
filename: "index1.html",
template: "src/index1.html"
}),
new HtmlWebpackPlugin({
chunks: ['index2'],
filename: "index2.html",
template: "src/index2.html"
}),
new HtmlWebpackPlugin({
chunks: ['index3'],
filename: "index3.html",
template: "src/index3.html"
}),
new HtmlWebpackPlugin({
chunks: ['docpage'],
filename: "docpage.html",
template: "src/docpage.html"
}),
new HtmlWebpackPlugin({
chunks: ['docpage'],
filename: "landingpage.html",
template: "src/landingpage.html"
}),
new HtmlWebpackPlugin({
chunks: ['docpage'],
filename: "QuasarFrameworkTreeConfigurator.html",
template: "src/QuasarFrameworkTreeConfigurator.html"
}),
new CopyPlugin([
{ from: 'src/images', to: 'images' },
{ from: 'src/statics', to: 'statics' },
{ from: 'node_modules/uswds/dist/img', to: 'img' },
{ from: 'node_modules/uswds/dist/fonts', to: 'fonts' }
]),
new CleanWebpackPlugin()
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
writeToDisk:true,
historyApiFallback: {
index: 'index1.html',
},
port: 9000
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'js/[name].js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
// Apply rule for .sass, .scss or .css files
test: /\.(sa|sc|c)ss$/,
// Set loaders to transform files.
// Loaders are applying from right to left(!)
// The first loader will be applied after others
use:
[
{
// After all CSS loaders we use plugin to do his work.
// It gets all transformed CSS and extracts it into separate
// single bundled file
loader: MiniCssExtractPlugin.loader
},
{
// This loader resolves url() and @imports inside CSS
loader: "css-loader",options: { url: false, sourceMap: true }
},
{
// Then we apply postCSS fixes like autoprefixer and minifying
loader: "postcss-loader",
options: {
sourceMap: true
}
},
{
// First we transform SASS to standard CSS
loader: "sass-loader",
options: {
implementation: require("node-sass"),
sassOptions: {
sourceMap: true,
includePaths: [
//join(dirname(module.filename), 'node_modules'),
//join(dirname(module.filename), 'node_modules/uswds/dist/scss')
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, 'node_modules/uswds/dist/scss'),
path.resolve(__dirname, 'node_modules/uswds/dist/fonts')
]
}
}
}
]
}
]
}
};