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

Commit 9feb407

Browse files
authoredJan 19, 2021
Merge pull request #61 from topcoder-platform/feature/build-improvements
Build improvements
2 parents 4d920d6 + 3dc8c76 commit 9feb407

File tree

6 files changed

+66
-55
lines changed

6 files changed

+66
-55
lines changed
 

‎babel.config.js

Lines changed: 59 additions & 0 deletions
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

Lines changed: 0 additions & 51 deletions
This file was deleted.
File renamed without changes.

‎config/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* global process */
22

33
module.exports = (() => {
4-
const env = process.env.NODE_ENV || "development";
4+
const env = process.env.APPENV || "dev";
55

66
// for security reason don't let to require any arbitrary file defined in process.env
7-
if (["production", "development"].indexOf(env) < 0) {
8-
return require("./development");
7+
if (["prod", "dev"].indexOf(env) < 0) {
8+
return require("./dev");
99
}
1010

1111
return require("./" + env);
File renamed without changes.

‎webpack.config.js

Lines changed: 4 additions & 1 deletion
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)
This repository has been archived.