Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit be2d73c

Browse files
committed
fix: issue #13
1 parent dec233c commit be2d73c

File tree

3 files changed

+63
-52
lines changed

3 files changed

+63
-52
lines changed

babel.config.js

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
module.exports = function (api) {
2+
const isProd = process.env.APPMODE === "production";
3+
api.cache(!isProd);
4+
5+
const generateScopedName = isProd
6+
? "[hash:base64:6]"
7+
: "teams_[path][name]___[local]___[hash:base64:6]";
8+
return {
9+
presets: ["@babel/preset-env", "@babel/preset-react"],
10+
plugins: [
11+
[
12+
"@babel/plugin-transform-runtime",
13+
{
14+
useESModules: true,
15+
regenerator: false,
16+
},
17+
],
18+
[
19+
"react-css-modules",
20+
{
21+
filetypes: {
22+
".scss": {
23+
syntax: "postcss-scss",
24+
},
25+
},
26+
generateScopedName,
27+
},
28+
],
29+
"inline-react-svg",
30+
],
31+
env: {
32+
test: {
33+
presets: [
34+
[
35+
"@babel/preset-env",
36+
{
37+
targets: "current node",
38+
},
39+
],
40+
],
41+
plugins: [
42+
[
43+
"module-resolver",
44+
{
45+
alias: {
46+
styles: "./src/styles",
47+
components: "./src/components",
48+
hooks: "./src/hooks",
49+
utils: "./src/utils",
50+
constants: "./src/constants",
51+
services: "./src/services",
52+
},
53+
},
54+
],
55+
],
56+
},
57+
},
58+
};
59+
};

babel.config.json

-51
This file was deleted.

webpack.config.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ const singleSpaDefaults = require("webpack-config-single-spa-react");
44
const path = require("path");
55
const autoprefixer = require("autoprefixer");
66

7-
const cssLocalIdent = "teams_[path][name]___[local]___[hash:base64:6]";
7+
8+
const cssLocalIdent = process.env.APPMODE === "production"
9+
? "[hash:base64:6]"
10+
: "teams_[path][name]___[local]___[hash:base64:6]";
811

912
module.exports = (webpackConfigEnv) => {
1013
const defaultConfig = singleSpaDefaults({

0 commit comments

Comments
 (0)