Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
96 lines (95 loc) · 2.56 KB
/
Copy pathwebpack.config.js
File metadata and controls
96 lines (95 loc) · 2.56 KB
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
/* eslint-env node */
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const JSON5 = require('json5');
module.exports = {
module: {
rules: [
{
test: /\.scss$/,
use: [
{
// CSSを別ファイルに出力
loader: MiniCssExtractPlugin.loader,
},
{
// CSSを読み込み
loader: 'css-loader',
options: {
url: true,
sourceMap: true,
},
},
{
// Sassを読み込み
loader: 'sass-loader',
options: {
implementation: require('sass'),
sassOptions: {
// fiber: require('fibers'),
fiber: false,
},
sourceMap: true,
},
},
],
},
{
test: /\.json5$/,
type: 'json',
parser: {
parse: JSON5.parse,
},
},
],
},
entry: {
background: './src/background/backgroundEvent.js',
main: './src/contents/main.js',
topPageStyle: './src/contents/styles/top/topPageStyle.scss',
'popup/popup': './src/popup/popup.js',
'options/options': './src/options/options.js',
'options/optionsUtils': './src/options/optionsUtils.js',
},
output: {
filename: '[name].js',
path: path.join(__dirname, 'dist'),
},
plugins: [
new CopyPlugin({
patterns: [
{ from: './src/manifest.json' },
{ from: './src/icons', to: 'icons' },
{ from: './src/popup/*.{html,css,svg}', to: './popup/[name][ext]' },
{ from: './src/options/*.{html,css,svg}', to: './options/[name][ext]' },
{ from: './src/contents/**/*.{html,css,svg}', to: '[name][ext]' },
],
}),
new MiniCssExtractPlugin({
filename: '[name].css',
}),
],
mode: 'development',
devtool: 'inline-cheap-source-map',
resolve: {
alias: {
// ライブラリファイルのエイリアス
Lib: path.join(__dirname, 'src/lib'),
Options: path.join(__dirname, 'src/options'),
Contents: path.join(__dirname, 'src/contents'),
Features: path.join(__dirname, 'src/contents/features'),
jQuery: `jquery`,
},
},
stats: {
builtAt: true,
errorsCount: true,
warningsCount: true,
timings: true,
},
watchOptions: {
ignored: /node_modules/,
poll: true,
},
};