forked from FriedChickenButt/youtube-webos
-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
webpack.config.js
66 lines (59 loc) · 1.61 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
import CopyPlugin from 'copy-webpack-plugin';
/** @type {(env: Record<string, string>) => (import('webpack').Configuration)[]} */
const makeConfig = () => [
{
/**
* NOTE: Builds with devtool = 'eval' contain very big eval chunks which seem
* to cause segfaults (at least) on nodeJS v0.12.2 used on webOS 3.x.
*/
devtool: 'source-map',
entry: {
index: './src/index.js',
userScript: {
import: './src/userScript.js',
filename: 'webOSUserScripts/[name].js'
}
},
resolve: {
extensions: ['.mjs', '.cjs', '.js', '.json']
},
module: {
rules: [
{
test: /\.[mc]?js$/i,
loader: 'babel-loader',
exclude: [
// Some module should not be transpiled by Babel
// See https://github.com/zloirock/core-js/issues/743#issuecomment-572074215
// \\ for Windows, / for macOS and Linux
/node_modules[\\/]core-js/,
/node_modules[\\/]webpack[\\/]buildin/
],
options: {
cacheDirectory: true
},
resolve: {
// File extension DON'T MATTER in a bundler.
fullySpecified: false
}
},
{
test: /\.css$/i,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader', options: { esModule: false } }
]
}
]
},
plugins: [
new CopyPlugin({
patterns: [
{ context: 'assets', from: '**/*' },
{ context: 'src', from: 'index.html' }
]
})
]
}
];
export default makeConfig;