Skip to content

Commit 5ba67bf

Browse files
authored
Fix esm-view not starting by downgrading esbuild-loader to 2.x.x (#2385)
* Fix esm-view not starting by downgrading esbuild-loader to 2.x.x * Add esmView start test and update snapshots
1 parent fff2361 commit 5ba67bf

File tree

10 files changed

+217
-298
lines changed

10 files changed

+217
-298
lines changed

.changeset/fifty-rats-add.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'modular-scripts': patch
3+
---
4+
5+
Fix esm-views not starting

packages/create-modular-react-app/src/__tests__/__snapshots__/index.test.ts.snap

Lines changed: 62 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,66 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`create-modular-react-app WHEN it sets up a project with prefer Offline SHOULD setup an package.json correctly 1`] = `
4+
{
5+
"author": "?",
6+
"browserslist": {
7+
"development": [
8+
"last 1 chrome version",
9+
"last 1 firefox version",
10+
"last 1 safari version",
11+
],
12+
"production": [
13+
">0.2%",
14+
"not dead",
15+
"not op_mini all",
16+
],
17+
},
18+
"dependencies": {
19+
"@testing-library/dom": "?",
20+
"@testing-library/jest-dom": "?",
21+
"@testing-library/react": "?",
22+
"@testing-library/user-event": "?",
23+
"@types/jest": "?",
24+
"@types/node": "?",
25+
"@types/react": "?",
26+
"@types/react-dom": "?",
27+
"eslint-config-modular-app": "?",
28+
"modular-scripts": "?",
29+
"prettier": "?",
30+
"react": "?",
31+
"react-dom": "?",
32+
"typescript": "?",
33+
},
34+
"eslintConfig": {
35+
"extends": "modular-app/recommended",
36+
},
37+
"license": "MIT",
38+
"main": "index.js",
39+
"modular": {
40+
"type": "root",
41+
},
42+
"name": "test-repo",
43+
"prettier": {
44+
"printWidth": 80,
45+
"proseWrap": "always",
46+
"singleQuote": true,
47+
"trailingComma": "all",
48+
},
49+
"private": true,
50+
"scripts": {
51+
"build": "modular build",
52+
"lint": "modular lint",
53+
"prettier": "prettier --write .",
54+
"start": "modular start",
55+
"test": "modular test",
56+
},
57+
"version": "1.0.0",
58+
"workspaces": [
59+
"packages/**",
60+
],
61+
}
62+
`;
63+
364
exports[`create-modular-react-app WHEN it sets up a project with prefer Offline should create a project with prefer offline 1`] = `
465
"test-repo
566
├─ .editorconfig
@@ -42,89 +103,7 @@ exports[`create-modular-react-app WHEN it sets up a project with prefer Offline
42103
└─ yarn.lock"
43104
`;
44105

45-
exports[`create-modular-react-app WHEN setting a project with defaults Sets up an app package.json correctly:
46-
Object {
47-
"author": "?",
48-
"dependencies": Object {},
49-
"modular": Object {
50-
"type": "app",
51-
},
52-
"name": "app",
53-
"private": true,
54-
"version": "0.1.0",
55-
}
56-
1`] = `
57-
{
58-
"author": "?",
59-
"modular": {
60-
"type": "app",
61-
},
62-
"name": "app",
63-
"private": true,
64-
"version": "1.0.0",
65-
}
66-
`;
67-
68-
exports[`create-modular-react-app WHEN setting a project with defaults Sets up the package.json correctly:
69-
Object {
70-
"author": "?",
71-
"browserslist": Object {
72-
"development": Array [
73-
"last 1 chrome version",
74-
"last 1 firefox version",
75-
"last 1 safari version",
76-
],
77-
"production": Array [
78-
">0.2%",
79-
"not dead",
80-
"not op_mini all",
81-
],
82-
},
83-
"dependencies": Object {
84-
"@testing-library/dom": "?",
85-
"@testing-library/jest-dom": "?",
86-
"@testing-library/react": "?",
87-
"@testing-library/user-event": "?",
88-
"@types/jest": "?",
89-
"@types/node": "?",
90-
"@types/react": "?",
91-
"@types/react-dom": "?",
92-
"eslint-config-modular-app": "?",
93-
"modular-scripts": "?",
94-
"prettier": "?",
95-
"react": "?",
96-
"react-dom": "?",
97-
"typescript": "?",
98-
},
99-
"eslintConfig": Object {
100-
"extends": "modular-app",
101-
},
102-
"license": "MIT",
103-
"main": "index.js",
104-
"modular": Object {
105-
"type": "root",
106-
},
107-
"name": "test-repo",
108-
"prettier": Object {
109-
"printWidth": 80,
110-
"proseWrap": "always",
111-
"singleQuote": true,
112-
"trailingComma": "all",
113-
},
114-
"private": true,
115-
"scripts": Object {
116-
"build": "modular build",
117-
"lint": "modular lint",
118-
"prettier": "prettier --write .",
119-
"start": "modular start",
120-
"test": "modular test",
121-
},
122-
"version": "1.0.0",
123-
"workspaces": Array [
124-
"packages/**",
125-
],
126-
}
127-
1`] = `
106+
exports[`create-modular-react-app WHEN setting a project with defaults Sets up the package.json correctly 1`] = `
128107
{
129108
"author": "?",
130109
"browserslist": {
@@ -150,7 +129,6 @@ exports[`create-modular-react-app WHEN setting a project with defaults Sets up t
150129
"@types/react-dom": "?",
151130
"eslint-config-modular-app": "?",
152131
"modular-scripts": "?",
153-
"modular-template-app": "?",
154132
"prettier": "?",
155133
"react": "?",
156134
"react-dom": "?",

packages/create-modular-react-app/src/__tests__/index.test.ts

Lines changed: 17 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -70,85 +70,25 @@ describe('create-modular-react-app', () => {
7070
it('Sets up the package.json correctly', async () => {
7171
expect(
7272
await readCensoredPackageJson(path.join(destination, 'package.json')),
73-
).toMatchSnapshot(`
74-
Object {
75-
"author": "?",
76-
"browserslist": Object {
77-
"development": Array [
78-
"last 1 chrome version",
79-
"last 1 firefox version",
80-
"last 1 safari version",
81-
],
82-
"production": Array [
83-
">0.2%",
84-
"not dead",
85-
"not op_mini all",
86-
],
87-
},
88-
"dependencies": Object {
89-
"@testing-library/dom": "?",
90-
"@testing-library/jest-dom": "?",
91-
"@testing-library/react": "?",
92-
"@testing-library/user-event": "?",
93-
"@types/jest": "?",
94-
"@types/node": "?",
95-
"@types/react": "?",
96-
"@types/react-dom": "?",
97-
"eslint-config-modular-app": "?",
98-
"modular-scripts": "?",
99-
"prettier": "?",
100-
"react": "?",
101-
"react-dom": "?",
102-
"typescript": "?",
103-
},
104-
"eslintConfig": Object {
105-
"extends": "modular-app",
106-
},
107-
"license": "MIT",
108-
"main": "index.js",
109-
"modular": Object {
110-
"type": "root",
111-
},
112-
"name": "test-repo",
113-
"prettier": Object {
114-
"printWidth": 80,
115-
"proseWrap": "always",
116-
"singleQuote": true,
117-
"trailingComma": "all",
118-
},
119-
"private": true,
120-
"scripts": Object {
121-
"build": "modular build",
122-
"lint": "modular lint",
123-
"prettier": "prettier --write .",
124-
"start": "modular start",
125-
"test": "modular test",
126-
},
127-
"version": "1.0.0",
128-
"workspaces": Array [
129-
"packages/**",
130-
],
131-
}
132-
`);
73+
).toMatchSnapshot();
13374
});
13475

13576
it('Sets up an app package.json correctly', async () => {
13677
expect(
13778
await readCensoredPackageJson(
13879
path.join(destination, 'packages', 'app', 'package.json'),
13980
),
140-
).toMatchSnapshot(`
141-
Object {
142-
"author": "?",
143-
"dependencies": Object {},
144-
"modular": Object {
145-
"type": "app",
146-
},
147-
"name": "app",
148-
"private": true,
149-
"version": "0.1.0",
150-
}
151-
`);
81+
).toMatchInlineSnapshot(`
82+
{
83+
"author": "?",
84+
"modular": {
85+
"type": "app",
86+
},
87+
"name": "app",
88+
"private": true,
89+
"version": "1.0.0",
90+
}
91+
`);
15292
});
15393
});
15494

@@ -168,83 +108,23 @@ describe('create-modular-react-app', () => {
168108
it('SHOULD setup an package.json correctly', async () => {
169109
expect(
170110
await readCensoredPackageJson(path.join(destination, 'package.json')),
171-
).toMatchSnapshot(`
172-
Object {
173-
"author": "?",
174-
"browserslist": Object {
175-
"development": Array [
176-
"last 1 chrome version",
177-
"last 1 firefox version",
178-
"last 1 safari version",
179-
],
180-
"production": Array [
181-
">0.2%",
182-
"not dead",
183-
"not op_mini all",
184-
],
185-
},
186-
"dependencies": Object {
187-
"@testing-library/dom": "?",
188-
"@testing-library/jest-dom": "?",
189-
"@testing-library/react": "?",
190-
"@testing-library/user-event": "?",
191-
"@types/jest": "?",
192-
"@types/node": "?",
193-
"@types/react": "?",
194-
"@types/react-dom": "?",
195-
"eslint-config-modular-app": "?",
196-
"modular-scripts": "?",
197-
"prettier": "?",
198-
"react": "?",
199-
"react-dom": "?",
200-
"typescript": "?",
201-
},
202-
"eslintConfig": Object {
203-
"extends": "modular-app",
204-
},
205-
"license": "MIT",
206-
"main": "index.js",
207-
"modular": Object {
208-
"type": "root",
209-
},
210-
"name": "test-repo",
211-
"prettier": Object {
212-
"printWidth": 80,
213-
"proseWrap": "always",
214-
"singleQuote": true,
215-
"trailingComma": "all",
216-
},
217-
"private": true,
218-
"scripts": Object {
219-
"build": "modular build",
220-
"lint": "modular lint",
221-
"prettier": "prettier --write .",
222-
"start": "modular start",
223-
"test": "modular test",
224-
},
225-
"version": "1.0.0",
226-
"workspaces": Array [
227-
"packages/**",
228-
],
229-
}
230-
`);
111+
).toMatchSnapshot();
231112
});
232113

233114
it('SHOULD setup an app package.json correctly', async () => {
234115
expect(
235116
await readCensoredPackageJson(
236117
path.join(destination, 'packages', 'app', 'package.json'),
237118
),
238-
).toMatchSnapshot(`
239-
Object {
119+
).toMatchInlineSnapshot(`
120+
{
240121
"author": "?",
241-
"dependencies": Object {},
242-
"modular": Object {
122+
"modular": {
243123
"type": "app",
244124
},
245125
"name": "app",
246126
"private": true,
247-
"version": "0.1.0",
127+
"version": "1.0.0",
248128
}
249129
`);
250130
});

packages/modular-scripts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"dotenv": "16.0.2",
6767
"dotenv-expand": "8.0.3",
6868
"esbuild": "0.17.14",
69-
"esbuild-loader": "3.0.1",
69+
"esbuild-loader": "^2.16.0",
7070
"escape-string-regexp": "2.0.0",
7171
"eslint": "8.28.0",
7272
"execa": "5.1.1",

packages/modular-scripts/src/__tests__/__snapshots__/app.node-env.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ exports[`when working with a NODE_ENV app WHEN building with esbuild can generat
66
"
77
`;
88

9-
exports[`when working with a NODE_ENV app WHEN building with webpack can generate a js/main.5d879077.js 1`] = `
9+
exports[`when working with a NODE_ENV app WHEN building with webpack can generate a js/main.a482480b.js 1`] = `
1010
""use strict";
1111
(self.webpackChunknode_env_app = self.webpackChunknode_env_app || []).push([
1212
[179],
1313
{
14-
560: () => {
14+
908: () => {
1515
console.log("production");
1616
},
1717
},
1818
(e) => {
1919
var n;
20-
(n = 560), e((e.s = n));
20+
(n = 908), e((e.s = n));
2121
},
2222
]);
23-
//# sourceMappingURL=main.6f2657b7.js.map
23+
//# sourceMappingURL=main.a482480b.js.map
2424
"
2525
`;

0 commit comments

Comments
 (0)