-
-
Notifications
You must be signed in to change notification settings - Fork 530
Expand file tree
/
Copy pathnext.config.js
More file actions
41 lines (38 loc) · 979 Bytes
/
Copy pathnext.config.js
File metadata and controls
41 lines (38 loc) · 979 Bytes
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
const path = require("path");
const NODE_MODULES = path.resolve(__dirname, "./node_modules/");
const babel_options = {
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript",
]
};
module.exports = {
experimental: { esmExternals: "loose", },
webpack: (config) => {
[".scss", ".tsx", ".jsx", ".ts", ".js"].map(ext => {
if (!config.resolve.extensions.includes(ext)) {
config.resolve.extensions.push(ext);
}
});
config.resolve.alias = {
...(config.resolve.alias || {}),
["react"]: path.resolve(NODE_MODULES, "react"),
["react-dom"]: path.resolve(NODE_MODULES, "react-dom"),
};
config.module.rules.push(
{
test: /\.[jt]sx?$/,
exclude: /(node_modules)/,
use: [{
loader: "babel-loader",
options: {
...babel_options,
cacheDirectory: true
}
}],
}
);
return config;
}
};