-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into css-modules
- Loading branch information
Showing
184 changed files
with
3,532 additions
and
106 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
1 change: 1 addition & 0 deletions
1
tests/code-splitting/subtests/between-new-worker-type/parcel/index.md
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--- | ||
result: fail | ||
issue: https://github.com/parcel-bundler/parcel/issues/4320 | ||
--- | ||
|
||
There is a [plugin infrastructure for Parcel 2](https://github.com/parcel-bundler/parcel/tree/bb5ad3d1adaebb42514750b12d8f7470d66a7bd9) that is probably capable of solving this, but at the time of writing, the documentation doesn’t really tell me _how_. |
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
16 changes: 16 additions & 0 deletions
16
tests/code-splitting/subtests/between-new-worker-type/webpack/index.md
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,16 @@ | ||
--- | ||
result: fail | ||
--- | ||
|
||
Bundling Web Workers is possible in Webpack using one of the many add-ons like [worker-loader] or [worker-plugin], however there is no documented solution for accessing the underlying behavior: compiling a new entry starting from a given module and returning its bundle URL. There have been [some](https://github.com/webpack-contrib/worker-loader/pull/159) [attempts](https://github.com/webpack-contrib/worker-loader/pull/227) to support this in worker-loader, but at present the only available solution is [worker-plugin/loader]: | ||
|
||
```js | ||
import workerUrl from 'worker-plugin/loader!./my-worker'; | ||
new Worker(workerUrl); | ||
``` | ||
|
||
This makes it possible to bundle code for use in new worker-like environments like Worklets, however code splitting between the "host" and "child" sets of bundles is still not supported. | ||
|
||
[worker-loader]: https://github.com/webpack-contrib/worker-loader | ||
[worker-plugin]: https://github.com/GoogleChromeLabs/worker-plugin | ||
[worker-plugin/loader]: https://github.com/GoogleChromeLabs/worker-plugin#loader |
11 changes: 11 additions & 0 deletions
11
tests/code-splitting/subtests/between-new-worker-type/webpack/package.json
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,11 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"start": "webpack -p" | ||
}, | ||
"devDependencies": { | ||
"webpack": "4.41.5", | ||
"webpack-cli": "3.3.10", | ||
"worker-plugin": "4.0.2" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/code-splitting/subtests/between-new-worker-type/webpack/src/index.js
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,17 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import workerURL from 'omt!./worker.js'; | ||
import { logCaps } from './utils.js'; | ||
|
||
new InterestingNewWorkerType(workerURL); | ||
logCaps('This is index'); |
15 changes: 15 additions & 0 deletions
15
tests/code-splitting/subtests/between-new-worker-type/webpack/src/utils.js
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,15 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
export function logCaps(msg) { | ||
console.log(msg.toUpperCase()); | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/code-splitting/subtests/between-new-worker-type/webpack/src/worker.js
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,14 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { logCaps } from './utils.js'; | ||
logCaps('This is worker'); |
4 changes: 4 additions & 0 deletions
4
tests/code-splitting/subtests/between-new-worker-type/webpack/test/index.html
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,4 @@ | ||
<!DOCTYPE html> | ||
<base href="../build/"> | ||
<h1>See console</h1> | ||
<script src="index.js"></script> |
31 changes: 31 additions & 0 deletions
31
tests/code-splitting/subtests/between-new-worker-type/webpack/webpack.config.js
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,31 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
module.exports = { | ||
resolveLoader: { | ||
alias: { | ||
omt: 'worker-plugin/loader?esModule', | ||
}, | ||
}, | ||
optimization: { | ||
// create a runtime.js script containing the module loader: | ||
// (without this, entry chunks dependencies must be loaded manually) | ||
runtimeChunk: 'single', | ||
|
||
splitChunks: { | ||
// extract shared dependencies from entry bundles: | ||
chunks: 'all', | ||
// allow any size dependency to be shared: | ||
minSize: 0, | ||
}, | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--- | ||
result: partial | ||
issue: https://github.com/parcel-bundler/parcel/issues/1654 | ||
--- | ||
|
||
Parcel can handle workers, but doesn’t split out shared dependencies. |
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
12 changes: 12 additions & 0 deletions
12
tests/code-splitting/subtests/between-workers/webpack/package.json
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,12 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"start": "webpack -p" | ||
}, | ||
"devDependencies": { | ||
"webpack": "4.41.5", | ||
"webpack-cli": "3.3.10", | ||
"worker-loader": "2.0.0", | ||
"worker-plugin": "3.2.0" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/code-splitting/subtests/between-workers/webpack/src/index.js
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,17 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { logCaps } from './utils.js'; | ||
// Alternative: | ||
// require('worker-loader!./worker.js')(); | ||
new Worker('./worker.js', { type: 'module' }); | ||
logCaps('This is index'); |
15 changes: 15 additions & 0 deletions
15
tests/code-splitting/subtests/between-workers/webpack/src/utils.js
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,15 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
export function logCaps(msg) { | ||
console.log(msg.toUpperCase()); | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/code-splitting/subtests/between-workers/webpack/src/worker.js
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,14 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { logCaps } from './utils.js'; | ||
logCaps('This is worker'); |
4 changes: 4 additions & 0 deletions
4
tests/code-splitting/subtests/between-workers/webpack/test/index.html
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,4 @@ | ||
<!DOCTYPE html> | ||
<base href="../build/"> | ||
<h1>See console</h1> | ||
<script src="index.js"></script> |
30 changes: 30 additions & 0 deletions
30
tests/code-splitting/subtests/between-workers/webpack/webpack.config.js
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,30 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
const WorkerPlugin = require('worker-plugin'); | ||
|
||
module.exports = { | ||
output: { | ||
// at some point this will probably become the default value: | ||
globalObject: 'self', | ||
}, | ||
plugins: [new WorkerPlugin()], | ||
optimization: { | ||
// create a dedicated bootstrap + hash mapping bundle: | ||
runtimeChunk: 'single', | ||
// extract all shared dependencies from entry bundles: | ||
splitChunks: { | ||
chunks: 'all', | ||
minSize: 0, | ||
}, | ||
}, | ||
}; |
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
10 changes: 10 additions & 0 deletions
10
tests/code-splitting/subtests/dynamic-import/webpack/package.json
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,10 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"start": "webpack -p" | ||
}, | ||
"devDependencies": { | ||
"webpack": "4.41.5", | ||
"webpack-cli": "3.3.10" | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/code-splitting/subtests/dynamic-import/webpack/src/index.js
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,16 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
(async function() { | ||
const { logCaps } = await import('./utils.js'); | ||
logCaps('This is index'); | ||
})(); |
15 changes: 15 additions & 0 deletions
15
tests/code-splitting/subtests/dynamic-import/webpack/src/utils.js
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,15 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
export function logCaps(msg) { | ||
console.log(msg.toUpperCase()); | ||
} |
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
--- | ||
result: fail | ||
issue: | ||
- https://github.com/parcel-bundler/parcel/issues/4303 | ||
- https://github.com/parcel-bundler/parcel/issues/4304 | ||
--- | ||
|
||
Parcel can take multiple entry points, but doesn’t split out common dependencies. | ||
Parcel tries to code split here, but generates invalid HTML in the process. |
Oops, something went wrong.