Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e83bc84

Browse files
committedApr 12, 2021
perf: add experimental support for importModule
This replaces the child compiler with a lightweight execution of modules within the module graph of the original compilation
1 parent a33f22f commit e83bc84

File tree

66 files changed

+4255
-180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4255
-180
lines changed
 

‎.github/workflows/nodejs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ jobs:
5757
os: [ubuntu-latest, windows-latest, macos-latest]
5858
node-version: [10.x, 12.x, 14.x]
5959
webpack-version: [4, latest]
60+
experimental-use-import-module: [false]
61+
include:
62+
- os: 'ubuntu-latest'
63+
node-version: 14.x
64+
webpack-version: latest
65+
experimental-use-import-module: true
6066

6167
runs-on: ${{ matrix.os }}
68+
continue-on-error: ${{ matrix.experimental-use-import-module }}
6269

6370
steps:
6471
- name: Setup Git
@@ -87,8 +94,13 @@ jobs:
8794
run: npm i webpack@${{ matrix.webpack-version }}
8895

8996
- name: Run tests for webpack version ${{ matrix.webpack-version }}
97+
if: ${{ !matrix.experimental-use-import-module }}
9098
run: npm run test:coverage -- --ci
9199

100+
- name: Run optional tests for webpack version ${{ matrix.webpack-version }} with import module
101+
if: ${{ matrix.experimental-use-import-module }}
102+
run: EXPERIMENTAL_USE_IMPORT_MODULE=true npm run test:coverage -- --ci
103+
92104
- name: Submit coverage data to codecov
93105
uses: codecov/codecov-action@v1
94106
with:

‎README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,15 @@ module.exports = {
7575

7676
### Plugin Options
7777

78-
| Name | Type | Default | Description |
79-
| :-----------------------------------: | :------------------: | :-----------------------------------: | :--------------------------------------------------------- |
80-
| **[`filename`](#filename)** | `{String\|Function}` | `[name].css` | This option determines the name of each output CSS file |
81-
| **[`chunkFilename`](#chunkFilename)** | `{String\|Function}` | `based on filename` | This option determines the name of non-entry chunk files |
82-
| **[`ignoreOrder`](#ignoreOrder)** | `{Boolean}` | `false` | Remove Order Warnings |
83-
| **[`insert`](#insert)** | `{String\|Function}` | `document.head.appendChild(linkTag);` | Inserts `<link>` at the given position |
84-
| **[`attributes`](#attributes)** | `{Object}` | `{}` | Adds custom attributes to tag |
85-
| **[`linkType`](#linkType)** | `{String\|Boolean}` | `text/css` | Allows loading asynchronous chunks with a custom link type |
78+
| Name | Type | Default | Description |
79+
| :---------------------------------------------------------------: | :------------------: | :-----------------------------------: | :---------------------------------------------------------------------------- |
80+
| **[`filename`](#filename)** | `{String\|Function}` | `[name].css` | This option determines the name of each output CSS file |
81+
| **[`chunkFilename`](#chunkFilename)** | `{String\|Function}` | `based on filename` | This option determines the name of non-entry chunk files |
82+
| **[`ignoreOrder`](#ignoreOrder)** | `{Boolean}` | `false` | Remove Order Warnings |
83+
| **[`insert`](#insert)** | `{String\|Function}` | `document.head.appendChild(linkTag);` | Inserts `<link>` at the given position |
84+
| **[`attributes`](#attributes)** | `{Object}` | `{}` | Adds custom attributes to tag |
85+
| **[`linkType`](#linkType)** | `{String\|Boolean}` | `text/css` | Allows loading asynchronous chunks with a custom link type |
86+
| **[`experimentalUseImportModule`](#experimentalUseImportModule)** | `{Boolean}` | `false` | Use an experimental webpack API to execute modules instead of child compilers |
8687

8788
#### `filename`
8889

@@ -256,6 +257,14 @@ module.exports = {
256257
};
257258
```
258259

260+
#### `experimentalUseImportModule`
261+
262+
Use an experimental webpack API to execute modules instead of child compilers.
263+
264+
This improves performance and memory usage a lot, but isn't as stable as the normal approach.
265+
266+
When combined with `experiments.layers`, this adds a `layer` option to the loader options to specify the layer of the css execution.
267+
259268
### Loader Options
260269

261270
| Name | Type | Default | Description |

0 commit comments

Comments
 (0)
Please sign in to comment.