Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set output.chunkFormat to commonjs by default #2136

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -201,6 +202,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -342,6 +344,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -483,6 +486,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -621,6 +625,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -762,6 +767,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -903,6 +909,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -1044,6 +1051,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -1193,6 +1201,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -1342,6 +1351,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -1492,6 +1502,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -1633,6 +1644,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -1774,6 +1786,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -1924,6 +1937,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -2077,6 +2091,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -2211,6 +2226,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down Expand Up @@ -2345,6 +2361,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t
],
},
"output": {
"chunkFormat": "commonjs",
"clean": false,
"filename": "bundle.js",
"library": {
Expand Down
10 changes: 10 additions & 0 deletions packages/snaps-cli/src/webpack/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ export async function getDefaultConfiguration(
*/
type: 'commonjs',
},

/**
* The chunk format. This tells Webpack how to export chunks. This is
* required because we use browserslist to target browsers, but Snaps are
* not fully compatible with browser APIs (such as `window` and
* `document`).
*
* @see https://webpack.js.org/configuration/output/#outputchunkformat
*/
chunkFormat: 'commonjs',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious how this is needed when we don't do chunks 🤔

Does Webpack see our bundle as 1 chunk then and still applies whatever chunking rules?

},

/**
Expand Down
Loading