Skip to content

Commit 9b7fb1d

Browse files
authored
Fix sandbox projects with no plugins (codesandbox#987)
* Use Terser * Update yarn * Update all nodes * Update cache key * Fix * Disable concatenation * Change * Unique names * Fix plugins * Revert "Unique names" This reverts commit f9393d6. * Revert "Change" This reverts commit 17b2648. * Revert "Disable concatenation" This reverts commit 11b9d5d. * Enable all optimizations with terser
1 parent 6c6af0d commit 9b7fb1d

File tree

6 files changed

+41
-42
lines changed

6 files changed

+41
-42
lines changed

.circleci/config.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ version: 2
33
jobs:
44
build-dependencies:
55
docker:
6-
- image: circleci/node:9
6+
- image: circleci/node:10
77
working_directory: ~/codesandbox-client
88
steps:
99
- checkout
1010
- restore_cache:
1111
keys:
12-
- v11-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
13-
- v11-dependency-cache-{{ .Branch }}
14-
- v11-dependency-cache
12+
- v12-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
13+
- v12-dependency-cache-{{ .Branch }}
14+
- v12-dependency-cache
1515
- restore_cache:
1616
keys:
17-
- v11-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
18-
- v11-standalone-dependency-cache-{{ .Branch }}
19-
- v11-standalone-dependency-cache
17+
- v12-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
18+
- v12-standalone-dependency-cache-{{ .Branch }}
19+
- v12-standalone-dependency-cache
2020
- run:
2121
name: Install Dependencies
2222
command: yarn install
2323
- save_cache:
24-
key: v11-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
24+
key: v12-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
2525
paths:
2626
- node_modules
2727
- packages/app/node_modules
@@ -31,36 +31,36 @@ jobs:
3131
- packages/react-sandpack/node_modules
3232
- packages/sandpack/node_modules
3333
- save_cache:
34-
key: v11-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
34+
key: v12-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
3535
paths:
3636
- standalone-packages/codesandbox-browserfs/node_modules
3737
- run:
3838
name: Build
3939
command: yarn build:deps
4040
- save_cache:
41-
key: v11-repo-{{ .Environment.CIRCLE_SHA1 }}
41+
key: v12-repo-{{ .Environment.CIRCLE_SHA1 }}
4242
paths:
4343
- ~/codesandbox-client
4444

4545
build-prod:
4646
docker:
47-
- image: circleci/node:9
47+
- image: circleci/node:10
4848
working_directory: ~/codesandbox-client
4949
steps:
5050
- restore_cache:
51-
key: v11-repo-{{ .Environment.CIRCLE_SHA1 }}
51+
key: v12-repo-{{ .Environment.CIRCLE_SHA1 }}
5252
# We do this to compare sizes from these builds with master
5353
- restore_cache:
54-
key: v11-prod-app-build-cache-master
54+
key: v12-prod-app-build-cache-master
5555
- run:
5656
name: Build Application
5757
command: yarn build:prod
5858
- save_cache:
59-
key: v11-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
59+
key: v12-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
6060
paths:
6161
- ./packages/app/www
6262
- save_cache:
63-
key: v11-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
63+
key: v12-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
6464
paths:
6565
- ./www
6666

@@ -70,7 +70,7 @@ jobs:
7070
working_directory: ~/codesandbox-client
7171
steps:
7272
- restore_cache:
73-
key: v11-repo-{{ .Environment.CIRCLE_SHA1 }}
73+
key: v12-repo-{{ .Environment.CIRCLE_SHA1 }}
7474
- run:
7575
name: Start Test Server
7676
command: yarn start:test
@@ -94,11 +94,11 @@ jobs:
9494

9595
test-jest:
9696
docker:
97-
- image: circleci/node:9
97+
- image: circleci/node:10
9898
working_directory: ~/codesandbox-client
9999
steps:
100100
- restore_cache:
101-
key: v11-repo-{{ .Environment.CIRCLE_SHA1 }}
101+
key: v12-repo-{{ .Environment.CIRCLE_SHA1 }}
102102
- run:
103103
name: Test
104104
command: yarn test --ci --testResultsProcessor="jest-junit"
@@ -107,11 +107,11 @@ jobs:
107107

108108
lint:
109109
docker:
110-
- image: circleci/node:9
110+
- image: circleci/node:10
111111
working_directory: ~/codesandbox-client
112112
steps:
113113
- restore_cache:
114-
key: v11-repo-{{ .Environment.CIRCLE_SHA1 }}
114+
key: v12-repo-{{ .Environment.CIRCLE_SHA1 }}
115115
- run:
116116
name: Lint
117117
command: yarn lint
@@ -122,7 +122,7 @@ jobs:
122122
steps:
123123
- checkout
124124
- restore_cache:
125-
key: v11-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
125+
key: v12-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
126126
- run:
127127
name: Docker Sign In
128128
command: "[ -n \"$DOCKER_USER\" ] && echo $DOCKER_PWD | docker login -u $DOCKER_USER --password-stdin || true"

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@
3636
"packages/sandpack",
3737
"packages/react-sandpack",
3838
"packages/homepage"
39-
],
40-
"nohoist": ["**/gatsby", "**/gatsby/**"]
39+
],
40+
"nohoist": ["**/gatsby", "**/gatsby/**"]
4141
},
42+
"resolutions": {
43+
"uglify-es": "npm:terser"
44+
},
4245
"devDependencies": {
4346
"all-contributors-cli": "^4.3.0",
4447
"babel-eslint": "^8.2.1",

packages/app/config/webpack.prod.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ module.exports = merge(commonConfig, {
4040
parallel: true,
4141
sourceMap: false,
4242
uglifyOptions: {
43-
compress: {
44-
// inline is buggy as of uglify-es 3.3.7
45-
// https://github.com/mishoo/UglifyJS2/issues/2842
46-
inline: 1,
47-
},
4843
mangle: {
4944
safari10: true,
5045
},

packages/app/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"version": "0.1.1",
44
"license": "MIT",
55
"private": true,
6+
"resolutions": {
7+
"uglify-es": "npm:terser"
8+
},
69
"scripts": {
710
"start": "cross-env LOCAL_SERVER=1 node scripts/start.js",
811
"start:sandbox": "cross-env SANDBOX_ONLY=true node scripts/start.js",
@@ -81,6 +84,7 @@
8184
"strip-ansi": "3.0.1",
8285
"style-loader": "^0.21.0",
8386
"sw-precache-webpack-plugin": "^0.11.5",
87+
"terser": "^3.8.0",
8488
"typescript": "^2.4.2",
8589
"uglifyjs-webpack-plugin": "^1.2.5",
8690
"url-loader": "1.0.1",

packages/app/src/sandbox/eval/transpilers/babel/babel-parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default function getBabelConfig(
5454
finalConfig.plugins.push('transform-es2015-modules-commonjs');
5555
}
5656
} else {
57-
finalConfig.plugins = 'transform-es2015-modules-commonjs';
57+
finalConfig.plugins = ['transform-es2015-modules-commonjs'];
5858
}
5959

6060
return finalConfig;

yarn.lock

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4352,18 +4352,14 @@ [email protected], [email protected]:
43524352
dependencies:
43534353
graceful-readlink ">= 1.0.0"
43544354

4355-
commander@^2.14.1, commander@^2.9.0:
4355+
commander@^2.14.1, commander@^2.9.0, commander@~2.16.0:
43564356
version "2.16.0"
43574357
resolved "https://registry.yarnpkg.com/commander/-/commander-2.16.0.tgz#f16390593996ceb4f3eeb020b31d78528f7f8a50"
43584358

43594359
commander@~2.1.0:
43604360
version "2.1.0"
43614361
resolved "https://registry.yarnpkg.com/commander/-/commander-2.1.0.tgz#d121bbae860d9992a3d517ba96f56588e47c6781"
43624362

4363-
commander@~2.13.0:
4364-
version "2.13.0"
4365-
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
4366-
43674363
commander@~2.8.1:
43684364
version "2.8.1"
43694365
resolved "https://registry.yarnpkg.com/commander/-/commander-2.8.1.tgz#06be367febfda0c330aa1e2a072d3dc9762425d4"
@@ -17244,7 +17240,7 @@ source-map-support@^0.4.0, source-map-support@^0.4.15, source-map-support@^0.4.4
1724417240
dependencies:
1724517241
source-map "^0.5.6"
1724617242

17247-
source-map-support@^0.5.0, source-map-support@^0.5.3, source-map-support@^0.5.5:
17243+
source-map-support@^0.5.0, source-map-support@^0.5.3, source-map-support@^0.5.5, source-map-support@~0.5.6:
1724817244
version "0.5.6"
1724917245
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13"
1725017246
dependencies:
@@ -18125,6 +18121,14 @@ tern@^0.21.0:
1812518121
minimatch "^3.0.3"
1812618122
resolve-from "2.0.0"
1812718123

18124+
terser@^3.8.0, uglify-es@^3.3.4, uglify-es@^3.3.7, uglify-es@^3.3.9, "uglify-es@npm:terser":
18125+
version "3.8.0"
18126+
resolved "https://registry.yarnpkg.com/terser/-/terser-3.8.0.tgz#66a4f4f500d2c829faab840f318c49cc471d73ae"
18127+
dependencies:
18128+
commander "~2.16.0"
18129+
source-map "~0.6.1"
18130+
source-map-support "~0.5.6"
18131+
1812818132
test-exclude@^4.2.1:
1812918133
version "4.2.1"
1813018134
resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.1.tgz#dfa222f03480bca69207ca728b37d74b45f724fa"
@@ -18710,13 +18714,6 @@ ua-parser-js@^0.7.18, ua-parser-js@^0.7.9:
1871018714
version "0.7.18"
1871118715
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed"
1871218716

18713-
uglify-es@^3.3.4, uglify-es@^3.3.7, uglify-es@^3.3.9:
18714-
version "3.3.9"
18715-
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677"
18716-
dependencies:
18717-
commander "~2.13.0"
18718-
source-map "~0.6.1"
18719-
1872018717
1872118718
version "3.3.28"
1872218719
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.28.tgz#0efb9a13850e11303361c1051f64d2ec68d9be06"

0 commit comments

Comments
 (0)