-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenableEmotionRSC.js
More file actions
35 lines (30 loc) · 1011 Bytes
/
enableEmotionRSC.js
File metadata and controls
35 lines (30 loc) · 1011 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
const path = require('path');
const includedDirs = [path.resolve(__dirname, 'src')];
module.exports = function enableEmotionRSC(nextConfig) {
return {
...nextConfig,
webpack: (config, { isServer }) => {
config.module.rules = config.module.rules.filter(
(rule) =>
!(rule.test && rule.test.test && rule.test.test('.tsx'))
);
config.module.rules.push({
test: /\.tsx?$/,
include: includedDirs,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true,
configFile: path.resolve(__dirname, 'tsconfig.json')
}
}
]
});
if (isServer) {
config.resolve.alias['@emotion/react'] = 'react';
}
return config;
}
};
};