-
-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added the
emit
option for SSR (#732)
- Loading branch information
1 parent
07b8910
commit 03b4293
Showing
27 changed files
with
1,241 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,9 @@ | |
} | ||
] | ||
}, | ||
"emit": { | ||
"type": "boolean" | ||
}, | ||
"esModule": { | ||
"type": "boolean" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`HMR should handle error event 1`] = `"[HMR] css reload %s"`; | ||
|
||
exports[`HMR should handle error event 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`; | ||
|
||
exports[`HMR should reloads with # link href 1`] = `"[HMR] css reload %s"`; | ||
|
||
exports[`HMR should reloads with # link href 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\"><link rel=\\"shortcut icon\\" href=\\"#href\\">"`; | ||
|
||
exports[`HMR should reloads with absolute remove url 1`] = `"[HMR] css reload %s"`; | ||
|
||
exports[`HMR should reloads with absolute remove url 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\"><link rel=\\"stylesheet\\" href=\\"http://dev.com/dist/main.css\\">"`; | ||
|
||
exports[`HMR should reloads with link without href 1`] = `"[HMR] css reload %s"`; | ||
|
||
exports[`HMR should reloads with link without href 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\"><link rel=\\"shortcut icon\\">"`; | ||
|
||
exports[`HMR should reloads with locals 1`] = `"[HMR] Detected local css modules. Reload all css"`; | ||
|
||
exports[`HMR should reloads with locals 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`; | ||
|
||
exports[`HMR should reloads with non http/https link href 1`] = `"[HMR] css reload %s"`; | ||
|
||
exports[`HMR should reloads with non http/https link href 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\"><link rel=\\"shortcut icon\\" href=\\"data:;base64,=\\">"`; | ||
|
||
exports[`HMR should reloads with non-file script in the end of page 1`] = `"[HMR] Reload all css"`; | ||
|
||
exports[`HMR should reloads with non-file script in the end of page 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`; | ||
|
||
exports[`HMR should work reload all css 1`] = `"[HMR] Reload all css"`; | ||
|
||
exports[`HMR should work reload all css 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`; | ||
|
||
exports[`HMR should works 1`] = `"[HMR] css reload %s"`; | ||
|
||
exports[`HMR should works 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`; | ||
|
||
exports[`HMR should works with multiple updates 1`] = `"[HMR] css reload %s"`; | ||
|
||
exports[`HMR should works with multiple updates 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`; | ||
|
||
exports[`HMR should works with multiple updates 3`] = `"<link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200001\\">"`; |
File renamed without changes.
37 changes: 37 additions & 0 deletions
37
test/__snapshots__/attributes-option.test.js.snap.webpack5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`attributes option should work with attributes option: DOM 1`] = ` | ||
"<!DOCTYPE html><html><head> | ||
<title>style-loader test</title> | ||
<style id=\\"existing-style\\">.existing { color: yellow }</style> | ||
<link id=\\"target\\" data-target=\\"example\\" rel=\\"stylesheet\\" type=\\"text/css\\" href=\\"simple.css\\"><script charset=\\"utf-8\\" src=\\"simple.bundle.js\\"></script></head> | ||
<body> | ||
<h1>Body</h1> | ||
<div class=\\"target\\"></div> | ||
<iframe class=\\"iframeTarget\\"></iframe> | ||
|
||
|
||
</body></html>" | ||
`; | ||
|
||
exports[`attributes option should work with attributes option: errors 1`] = `Array []`; | ||
|
||
exports[`attributes option should work with attributes option: warnings 1`] = `Array []`; | ||
|
||
exports[`attributes option should work without attributes option: DOM 1`] = ` | ||
"<!DOCTYPE html><html><head> | ||
<title>style-loader test</title> | ||
<style id=\\"existing-style\\">.existing { color: yellow }</style> | ||
<link rel=\\"stylesheet\\" type=\\"text/css\\" href=\\"simple.css\\"><script charset=\\"utf-8\\" src=\\"simple.bundle.js\\"></script></head> | ||
<body> | ||
<h1>Body</h1> | ||
<div class=\\"target\\"></div> | ||
<iframe class=\\"iframeTarget\\"></iframe> | ||
|
||
|
||
</body></html>" | ||
`; | ||
|
||
exports[`attributes option should work without attributes option: errors 1`] = `Array []`; | ||
|
||
exports[`attributes option should work without attributes option: warnings 1`] = `Array []`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`emit option should work when emit option is "false": assets 1`] = ` | ||
Array [ | ||
"main.js", | ||
"react.svg", | ||
] | ||
`; | ||
|
||
exports[`emit option should work when emit option is "false": errors 1`] = `Array []`; | ||
|
||
exports[`emit option should work when emit option is "false": warnings 1`] = `Array []`; | ||
|
||
exports[`emit option should work when emit option is "true": assets 1`] = ` | ||
Array [ | ||
"main.css", | ||
"main.js", | ||
"react.svg", | ||
] | ||
`; | ||
|
||
exports[`emit option should work when emit option is "true": errors 1`] = `Array []`; | ||
|
||
exports[`emit option should work when emit option is "true": warnings 1`] = `Array []`; | ||
|
||
exports[`emit option should work with locals when emit option is "false": DOM 1`] = ` | ||
"<!DOCTYPE html><html><head> | ||
<title>style-loader test</title> | ||
<style id=\\"existing-style\\">.existing { color: yellow }</style> | ||
</head> | ||
<body> | ||
css.foo: _1F17fUrdX_cbcyDHpFqmAD | ||
css.bar: _3TZVxmkrZR2cTfifKhDoZn | ||
css.baz: M-pzkE59YBii7EXzFyxE6 | ||
</body></html>" | ||
`; | ||
|
||
exports[`emit option should work with locals when emit option is "false": errors 1`] = `Array []`; | ||
|
||
exports[`emit option should work with locals when emit option is "false": warnings 1`] = `Array []`; | ||
|
||
exports[`emit option should work without emit option: assets 1`] = ` | ||
Array [ | ||
"main.bundle.js", | ||
"main.css", | ||
"react.svg", | ||
] | ||
`; | ||
|
||
exports[`emit option should work without emit option: errors 1`] = `Array []`; | ||
|
||
exports[`emit option should work without emit option: warnings 1`] = `Array []`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`emit option should invalidate the cache with disabled "emit" option: assets 1`] = ` | ||
Array [ | ||
"main.js", | ||
"static/react.svg", | ||
] | ||
`; | ||
|
||
exports[`emit option should invalidate the cache with disabled "emit" option: assets 2`] = ` | ||
Array [ | ||
"main.js", | ||
] | ||
`; | ||
|
||
exports[`emit option should invalidate the cache with disabled "emit" option: emittedAssets 1`] = ` | ||
Array [ | ||
"main.js", | ||
"static/react.svg", | ||
] | ||
`; | ||
|
||
exports[`emit option should invalidate the cache with disabled "emit" option: emittedAssets 2`] = `Array []`; | ||
|
||
exports[`emit option should invalidate the cache with disabled "emit" option: errors 1`] = `Array []`; | ||
|
||
exports[`emit option should invalidate the cache with disabled "emit" option: errors 2`] = `Array []`; | ||
|
||
exports[`emit option should invalidate the cache with disabled "emit" option: warnings 1`] = `Array []`; | ||
|
||
exports[`emit option should invalidate the cache with disabled "emit" option: warnings 2`] = `Array []`; | ||
|
||
exports[`emit option should work when emit option is "false": assets 1`] = ` | ||
Array [ | ||
"main.js", | ||
"react.svg", | ||
] | ||
`; | ||
|
||
exports[`emit option should work when emit option is "false": errors 1`] = `Array []`; | ||
|
||
exports[`emit option should work when emit option is "false": warnings 1`] = `Array []`; | ||
|
||
exports[`emit option should work when emit option is "true": assets 1`] = ` | ||
Array [ | ||
"main.css", | ||
"main.js", | ||
"react.svg", | ||
] | ||
`; | ||
|
||
exports[`emit option should work when emit option is "true": errors 1`] = `Array []`; | ||
|
||
exports[`emit option should work when emit option is "true": warnings 1`] = `Array []`; | ||
|
||
exports[`emit option should work with locals and invalidate cache when emit option is "false": DOM 1`] = ` | ||
"<!DOCTYPE html><html><head> | ||
<title>style-loader test</title> | ||
<style id=\\"existing-style\\">.existing { color: yellow }</style> | ||
</head> | ||
<body> | ||
css.foo: _1F17fUrdX_cbcyDHpFqmAD | ||
css.bar: _3TZVxmkrZR2cTfifKhDoZn | ||
css.baz: M-pzkE59YBii7EXzFyxE6 | ||
</body></html>" | ||
`; | ||
|
||
exports[`emit option should work with locals and invalidate cache when emit option is "false": DOM 2`] = ` | ||
"<!DOCTYPE html><html><head> | ||
<title>style-loader test</title> | ||
<style id=\\"existing-style\\">.existing { color: yellow }</style> | ||
</head> | ||
<body> | ||
css.foo-bar: VWLDg_rByGM4Rdhz5T3Ns | ||
css.bar: _3TZVxmkrZR2cTfifKhDoZn | ||
css.baz: M-pzkE59YBii7EXzFyxE6 | ||
</body></html>" | ||
`; | ||
|
||
exports[`emit option should work with locals and invalidate cache when emit option is "false": assets 1`] = ` | ||
Array [ | ||
"main.js", | ||
] | ||
`; | ||
|
||
exports[`emit option should work with locals and invalidate cache when emit option is "false": assets 2`] = ` | ||
Array [ | ||
"main.js", | ||
] | ||
`; | ||
|
||
exports[`emit option should work with locals and invalidate cache when emit option is "false": emittedAssets 1`] = ` | ||
Array [ | ||
"main.js", | ||
] | ||
`; | ||
|
||
exports[`emit option should work with locals and invalidate cache when emit option is "false": emittedAssets 2`] = ` | ||
Array [ | ||
"main.js", | ||
] | ||
`; | ||
|
||
exports[`emit option should work with locals and invalidate cache when emit option is "false": errors 1`] = `Array []`; | ||
|
||
exports[`emit option should work with locals and invalidate cache when emit option is "false": errors 2`] = `Array []`; | ||
|
||
exports[`emit option should work with locals and invalidate cache when emit option is "false": warnings 1`] = `Array []`; | ||
|
||
exports[`emit option should work with locals and invalidate cache when emit option is "false": warnings 2`] = `Array []`; | ||
|
||
exports[`emit option should work with locals when emit option is "false": DOM 1`] = ` | ||
"<!DOCTYPE html><html><head> | ||
<title>style-loader test</title> | ||
<style id=\\"existing-style\\">.existing { color: yellow }</style> | ||
</head> | ||
<body> | ||
css.foo: _1F17fUrdX_cbcyDHpFqmAD | ||
css.bar: _3TZVxmkrZR2cTfifKhDoZn | ||
css.baz: M-pzkE59YBii7EXzFyxE6 | ||
</body></html>" | ||
`; | ||
|
||
exports[`emit option should work with locals when emit option is "false": errors 1`] = `Array []`; | ||
|
||
exports[`emit option should work with locals when emit option is "false": warnings 1`] = `Array []`; | ||
|
||
exports[`emit option should work with the "memory" cache and disabled "emit" option: assets 1`] = ` | ||
Array [ | ||
"main.js", | ||
"static/react.svg", | ||
] | ||
`; | ||
|
||
exports[`emit option should work with the "memory" cache and disabled "emit" option: assets 2`] = ` | ||
Array [ | ||
"main.js", | ||
"static/react.svg", | ||
] | ||
`; | ||
|
||
exports[`emit option should work with the "memory" cache and disabled "emit" option: emittedAssets 1`] = ` | ||
Array [ | ||
"main.js", | ||
"static/react.svg", | ||
] | ||
`; | ||
|
||
exports[`emit option should work with the "memory" cache and disabled "emit" option: emittedAssets 2`] = `Array []`; | ||
|
||
exports[`emit option should work with the "memory" cache and disabled "emit" option: errors 1`] = `Array []`; | ||
|
||
exports[`emit option should work with the "memory" cache and disabled "emit" option: errors 2`] = `Array []`; | ||
|
||
exports[`emit option should work with the "memory" cache and disabled "emit" option: warnings 1`] = `Array []`; | ||
|
||
exports[`emit option should work with the "memory" cache and disabled "emit" option: warnings 2`] = `Array []`; | ||
|
||
exports[`emit option should work without emit option: assets 1`] = ` | ||
Array [ | ||
"main.bundle.js", | ||
"main.css", | ||
"react.svg", | ||
] | ||
`; | ||
|
||
exports[`emit option should work without emit option: errors 1`] = `Array []`; | ||
|
||
exports[`emit option should work without emit option: warnings 1`] = `Array []`; |
File renamed without changes.
Oops, something went wrong.