forked from binary-com/deriv-bot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
94 lines (93 loc) · 3.02 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
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const path = require('path');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');
const MergeIntoSingleFilePlugin = require('webpack-merge-and-include-globally');
module.exports = {
entry : [
path.join(__dirname, 'src', 'app.js')
],
output: {
path : path.resolve(__dirname, 'dist'),
filename: 'bot.js',
},
devServer: {
publicPath: '/dist/',
disableHostCheck: true,
},
devtool: 'source-map',
target: 'web',
module: {
rules: [
{
test: /\.(s*)css$/,
use: [
'css-hot-loader',
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: { sourceMap: true },
},
{
loader: 'sass-loader',
options: { sourceMap: true },
}
]
},
{
test: /\.svg$/,
use: [
{
loader: 'svg-sprite-loader',
options: {
extract: true,
spriteFilename: 'bot-sprite.svg',
},
},
{
loader: 'svgo-loader',
options: {
plugins: [
{ removeUselessStrokeAndFill: false },
{ removeUnknownsAndDefaults: false },
],
},
},
],
},
{
enforce: "pre",
test: /\.(js|jsx)$/,
exclude: [/node_modules/],
loader: "eslint-loader",
options: {
fix: true
},
},
{
test : /\.(js|jsx)$/,
exclude: /node_modules/,
loader : 'babel-loader',
},
],
},
plugins: [
new MiniCssExtractPlugin({ filename: 'bot.css' }),
new StyleLintPlugin( { fix: true }),
new CopyWebpackPlugin([
{ from: './src/scratch/xml' },
{ from: './node_modules/scratch-blocks/media', to: 'media' },
]),
new MergeIntoSingleFilePlugin({
files: {
'scratch.js': [
'./node_modules/scratch-blocks/blockly_compressed_vertical.js',
'./node_modules/scratch-blocks/msg/messages.js',
'./node_modules/blockly/generators/javascript.js',
]
}
}),
new SpriteLoaderPlugin(),
],
};