-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
98 lines (97 loc) · 2.68 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
const path = require('path');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
target: 'web',
mode: 'development',
entry: {
tutorial: './src/tutorial.js',
tutorial_1: './src/tutorial_1.js',
sandbox: './src/sandbox.js',
browse: './src/browse.js',
gallery: './src/gallery.js',
artwork: './src/artwork.js',
block: './src/block.js',
home_page: './src/home_page.js',
index: './src/index.js',
blob_tutorial: './src/blob_tutorial.js',
rectangle_tutorial: './src/rectangle_tutorial.js',
main: './src/main.js',
canvas: './src/js/canvas.js'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'build')
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
filename: 'tutorial.html',
template: './src/assets/tutorial.html',
chunks: ['tutorial'],
favicon: './src/images/favicon.png'
}),
new HtmlWebpackPlugin({
filename: 'tutorial_1.html',
template: './src/assets/tutorial.html',
chunks: ['tutorial_1'],
favicon: './src/images/favicon.png'
}),
new HtmlWebpackPlugin({
filename: 'sandbox.html',
template: './src/assets/sandbox.html',
chunks: ['sandbox'],
favicon: './src/images/favicon.png'
}),
new HtmlWebpackPlugin({
filename: 'browse.html',
template: './src/assets/browse.html',
chunks: ['browse'],
favicon: './src/images/favicon.png'
}),
new HtmlWebpackPlugin({
filename: 'artwork.html',
template: './src/assets/sandbox.html',
chunksSortMode: 'manual',
chunks: ['artwork'],
favicon: './src/images/favicon.png'
}),
new HtmlWebpackPlugin({
filename: 'block.html',
template: './src/assets/block.html',
chunks: ['block'],
favicon: './src/images/favicon.png'
}),
new HtmlWebpackPlugin({
filename: 'gallery.html',
template: './src/assets/gallery.html',
chunks: ['gallery'],
favicon: './src/images/favicon.png'
}),
new webpack.optimize.ModuleConcatenationPlugin(),
// Copy over media resources from the Blockly package
new CopyPlugin([
{
from: path.resolve(__dirname, './node_modules/blockly/media'),
to: path.resolve(__dirname, 'build/media')
}
])
],
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource',
},
],
},
devServer: {
port: 3000
}
};