-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
113 lines (112 loc) · 2.8 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
const CopyWebpackPlugin = require("copy-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const path = require("path");
module.exports = [{
mode: "development",
entry: {
background: "./src/javascripts/background.js",
content: "./src/javascripts/content.js",
popup: "./src/javascripts/popup.js",
options: "./src/javascripts/options.js"
},
devtool: 'inline-source-map',
devServer: {
inline: true,
port: 8080,
historyApiFallback: true
},
output: {
path: path.resolve(__dirname, "./dist/assets/javascripts"),
filename: "[name].js",
devtoolModuleFilenameTemplate: 'dist/fuck'
},
module: {
rules: [
{
test: /\.jsx?$/,
loader: "babel-loader",
exclude: /node_modules/,
query: {
cacheDirectory: true,
retainLines: true
}
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
loaders: ["style-loader", "css-loader?modules"]
}
]
},
plugins: [
new ExtractTextPlugin("[name].css"),
new CopyWebpackPlugin([{
from: "src/html",
to: "../html"
},
{
from: "src/javascripts/popper.min.js",
to: "../javascripts/popper.min.js"
},
{
from: "src/javascripts/tooltip.min.js",
to: "../javascripts/tooltip.min.js"
},
{
from: "src/stylesheets",
to: "../stylesheets",
ignore: ['*.scss']
},
{
from: "src/images",
to: "../images"
},
{
from: "src/octicons",
to: "../octicons"
},
{
from: "src/sounds",
to: "../sounds"
},
{
from: "src/fonts",
to: "../fonts"
},
{
from: "manifest.json",
to: "../manifest.json"
},
])
],
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".scss"]
}
},
{
mode: "development",
entry: {
popup: "./src/stylesheets/popup.scss",
content: "./src/stylesheets/content.scss",
options: "./src/stylesheets/options.scss"
},
output: {
path: path.resolve(__dirname, "./dist/assets/stylesheets/"),
filename: "[name].css"
},
module: {
rules: [{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: ["css-loader", "sass-loader?outputStyle=expanded"]
})
}]
},
plugins: [new ExtractTextPlugin("[name].css")]
}
];