From 12066dbce6009e418c083ec5dcf06037c130088e Mon Sep 17 00:00:00 2001 From: Wei Date: Thu, 8 Aug 2024 14:22:18 +0800 Subject: [PATCH] feat: use "module-import" in ESM (#73) --- CONTRIBUTING.md | 2 +- package.json | 2 +- packages/core/src/config.ts | 2 +- .../tests/__snapshots__/config.test.ts.snap | 2 +- pnpm-lock.yaml | 100 +++++++++--------- 5 files changed, 54 insertions(+), 54 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 197ebcb35..2fd3a484b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -123,4 +123,4 @@ The project is still in its early stages and under active development, so it pos | Package | Link | | ------------ | ------------------------------------------------------- | -| @rspack/core | [PR](https://github.com/web-infra-dev/rspack/pull/7394) | +| @rspack/core | [PR](https://github.com/web-infra-dev/rspack/pull/7493) | diff --git a/package.json b/package.json index edc4f7b72..7cf5eb35c 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ }, "pnpm": { "overrides": { - "@rspack/core": "npm:@rspack/core-canary@1.0.0-canary-338cfbe-20240731183605" + "@rspack/core": "npm:@rspack/core-canary@1.0.0-canary-af0452f-20240808052639" } } } diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 9f4b658a8..6017a7410 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -114,7 +114,7 @@ const composeFormatConfig = (format: Format): RsbuildConfig => { return { tools: { rspack: { - externalsType: 'module', + externalsType: 'module-import', output: { module: true, chunkFormat: 'module', diff --git a/packages/core/tests/__snapshots__/config.test.ts.snap b/packages/core/tests/__snapshots__/config.test.ts.snap index 5534b8aea..e7ac347d6 100644 --- a/packages/core/tests/__snapshots__/config.test.ts.snap +++ b/packages/core/tests/__snapshots__/config.test.ts.snap @@ -41,7 +41,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config 1 "experiments": { "outputModule": true, }, - "externalsType": "module", + "externalsType": "module-import", "optimization": { "concatenateModules": true, }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eb860755f..b4f9cbab7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,7 +5,7 @@ settings: excludeLinksFromLockfile: false overrides: - '@rspack/core': npm:@rspack/core-canary@1.0.0-canary-338cfbe-20240731183605 + '@rspack/core': npm:@rspack/core-canary@1.0.0-canary-af0452f-20240808052639 importers: @@ -1227,56 +1227,56 @@ packages: peerDependencies: '@rsbuild/core': ^1.0.1-beta.9 - '@rspack/binding-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-lFl8Xt8QcNX0I1Kb/NfJYOa3B8iLBqw9T6CGylWbu0wQQ5TUnspGPfL7MIzi+mZ/eOaEcpIafUlCk+mcd5nC9Q==} + '@rspack/binding-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-VayW6Eytqn7TzoKvTeVR8k29JgEPOmnUFPRyoaf+QlATDR0pht4vwHeHCEYL587yxMw7pZ+DxfXgB1ReIViesA==} - '@rspack/binding-darwin-arm64-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-tO1ps4zfEk+3Sn4vKdn4RNcFqWl5IaNyYXZRHQtQXzJNAEBuSYeL9EDZMngjHQ7ymVfgwKR5Q+Tm0+SfPqO3cA==} + '@rspack/binding-darwin-arm64-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-rPS4GCOHbgXSociPieE5X2i2IXeADA+/1RD4grg+vvgKYzoZa8oVP4Nz6n67tj8jR7P6/eXjmbGwg8tXShFpyQ==} cpu: [arm64] os: [darwin] - '@rspack/binding-darwin-x64-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-puZ3ShmJZfj+wanaD6QX0sE3DFYDiSr3tHopLUPtDi2ogPR4EhhFmrHMHhZYcUetAxo9EDCVNolGn3hxIrpwcw==} + '@rspack/binding-darwin-x64-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-p7D2y7tYPReV6SNPB2FYv3OZeMnwU0WwlIinSDC0YJYZLwo5303zAnVY09s3R9t1Il86Du5wd9wRusSJKGN1/Q==} cpu: [x64] os: [darwin] - '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-JHh3W3l3dIbOtB8raKANqHn8L60IBTXx5CvjgoWHxqVlHeH8Szp7Uwnzf/7obWUbwONafOB9TBgqsKiRXtEn3w==} + '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-91KjddUlW5cFgE/Xy+l/KUkK/nMoKJjldeYvxUk7AyWpPW19vpP1kUpdpFmbjfinaAeXHCl0CiwIEMR3aVL1vw==} cpu: [arm64] os: [linux] - '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-/hkCF7w2ijmn260uPb49e3aaPjH/QWxymfLPI5nvC4+/Bk1XdYawIiy4A35Bv8kOuZciYYH3TMgkbXblqdamFA==} + '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-BT8PmQiCtEVTDWjZFur4ju7QoLhULZ2Qqfk7ZMA42TBFv2qpKpN0+Xpz/ZbiO+PEsjUrk2wib+MKppTGXOg2AA==} cpu: [arm64] os: [linux] - '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-Vpnqu3knK6YTmgvgIEFvEs1DbyVjyghdIrzIdkiJwhRF4AntZe3kxuM+x8fN94iDFHfRhWHTb1OkAooySaEGaw==} + '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-S9kb1X/xhPmyuNWr+VOW8gOZP0UKD0pyDOF/scaqdTxIsdq8x2Udpk9NG+GpJqsfJQq6qOnbN/4o/POi9dK3Bw==} cpu: [x64] os: [linux] - '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-ALlBgaoRXzYLeBfJLjVF9BpegYDD3wFk7Dtfnk/Ij9kTbzPmhYN5+5FIlTpANBbXfrknp+XqYoPRLsXI1EXtog==} + '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-JzzFQHKnXMEz5pC8fMYNK2w3v+WagOQGZ2cgeQzofa3DxCGFBN8xkcjTByTITXHK9FxIkP5AxbmDwruEPr1ovw==} cpu: [x64] os: [linux] - '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-ZH1F1zDnjRBPjfO1JzEwa9Wivy8oH81VFQVny0EWhqkzybjldrecAAp51+tsHcEiq8Tuc4c6BhJMfk2QWzQ+BQ==} + '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-QKYbZ7g1GeTn2HU+mK4UL9cMb1HZXsS2Bvp2Tkwqp4bXq+XYWVEtEy1t3veOhz+tx0NRvZ4R9F+XByE/eGRHHg==} cpu: [arm64] os: [win32] - '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-ww0uq30GTb33UpQ5fP07elvfCedlH+CM9BKpNidPci97/mSLcn823/jCBW2yzLauxFbcAdTWabaV5UhvmTfkAQ==} + '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-efyygQRoZ1ZDfKNn54DVAPtf4FFg6O3pkPlUUI9nj4HJd1S3NIjeMeKSCH77O6Ypqrs0uAILoalRnbGrh+oeZw==} cpu: [ia32] os: [win32] - '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-W2rL0V0S2KL9yUKSy493In/gWBPCcNIn9Ry1xegTbpNMU/++F5T9ZqI/whHets0uQMU9cKWFfQZmsSzCrIXiTg==} + '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-9XMPNGDPYQRfL9fPiCZKuKnC9sXNV0xJ2SDGJ+XZ0VQcGZ9z6810jUHAQX2gHSg8p6kUAtSXh68HsNWsSBlF9w==} cpu: [x64] os: [win32] - '@rspack/core-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-gPjYRA29rstYJHkcWmLuIgRq2mCknj22A1E65tg4i/K5yI6nCUxi+nvGVBBvNWKky+5ikGZxWK5O2I0IyH7hsQ==} + '@rspack/core-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-zuZ2FEYZy6ePZv2YPyT71BUJr6h5ZG6W8/s6rUXzMUzEmT6wlF073QvM8AWk9xUAXyv3NPdh3Ql5Kvf1/2RaBw==} engines: {node: '>=16.0.0'} peerDependencies: '@swc/helpers': '>=0.5.1' @@ -1284,8 +1284,8 @@ packages: '@swc/helpers': optional: true - '@rspack/lite-tapable-canary@1.0.0-canary-338cfbe-20240731183605': - resolution: {integrity: sha512-emikuiIbELsdO28IxMgjkcw8sovk9/BF+L7V3Ix75NLFc2+5MZ8LGteUFrhxfuXr/7eFY1eje858ZmeRPNr4fw==} + '@rspack/lite-tapable-canary@1.0.0-canary-af0452f-20240808052639': + resolution: {integrity: sha512-YpKLntATp0tML6ILrUmANCC6geUosgRK71xy78Vo1v2urSV1v2MB08VL6sbrjy99GnDWzf5f/bzrtmeC78GOVw==} engines: {node: '>=16.0.0'} '@rspack/lite-tapable@1.0.0-beta.2': @@ -4148,7 +4148,7 @@ snapshots: '@rsbuild/core@1.0.1-beta.10': dependencies: - '@rspack/core': '@rspack/core-canary@1.0.0-canary-338cfbe-20240731183605(@swc/helpers@0.5.11)' + '@rspack/core': '@rspack/core-canary@1.0.0-canary-af0452f-20240808052639(@swc/helpers@0.5.11)' '@rspack/lite-tapable': 1.0.0-beta.2 '@swc/helpers': 0.5.11 caniuse-lite: 1.0.30001649 @@ -4162,55 +4162,55 @@ snapshots: '@rspack/plugin-react-refresh': 1.0.0-beta.1(react-refresh@0.14.2) react-refresh: 0.14.2 - '@rspack/binding-canary@1.0.0-canary-338cfbe-20240731183605': + '@rspack/binding-canary@1.0.0-canary-af0452f-20240808052639': optionalDependencies: - '@rspack/binding-darwin-arm64': '@rspack/binding-darwin-arm64-canary@1.0.0-canary-338cfbe-20240731183605' - '@rspack/binding-darwin-x64': '@rspack/binding-darwin-x64-canary@1.0.0-canary-338cfbe-20240731183605' - '@rspack/binding-linux-arm64-gnu': '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-338cfbe-20240731183605' - '@rspack/binding-linux-arm64-musl': '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-338cfbe-20240731183605' - '@rspack/binding-linux-x64-gnu': '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-338cfbe-20240731183605' - '@rspack/binding-linux-x64-musl': '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-338cfbe-20240731183605' - '@rspack/binding-win32-arm64-msvc': '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-338cfbe-20240731183605' - '@rspack/binding-win32-ia32-msvc': '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-338cfbe-20240731183605' - '@rspack/binding-win32-x64-msvc': '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-338cfbe-20240731183605' - - '@rspack/binding-darwin-arm64-canary@1.0.0-canary-338cfbe-20240731183605': + '@rspack/binding-darwin-arm64': '@rspack/binding-darwin-arm64-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-darwin-x64': '@rspack/binding-darwin-x64-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-linux-arm64-gnu': '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-linux-arm64-musl': '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-linux-x64-gnu': '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-linux-x64-musl': '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-win32-arm64-msvc': '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-win32-ia32-msvc': '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/binding-win32-x64-msvc': '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-af0452f-20240808052639' + + '@rspack/binding-darwin-arm64-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-darwin-x64-canary@1.0.0-canary-338cfbe-20240731183605': + '@rspack/binding-darwin-x64-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-338cfbe-20240731183605': + '@rspack/binding-linux-arm64-gnu-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-338cfbe-20240731183605': + '@rspack/binding-linux-arm64-musl-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-338cfbe-20240731183605': + '@rspack/binding-linux-x64-gnu-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-338cfbe-20240731183605': + '@rspack/binding-linux-x64-musl-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-338cfbe-20240731183605': + '@rspack/binding-win32-arm64-msvc-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-338cfbe-20240731183605': + '@rspack/binding-win32-ia32-msvc-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-338cfbe-20240731183605': + '@rspack/binding-win32-x64-msvc-canary@1.0.0-canary-af0452f-20240808052639': optional: true - '@rspack/core-canary@1.0.0-canary-338cfbe-20240731183605(@swc/helpers@0.5.11)': + '@rspack/core-canary@1.0.0-canary-af0452f-20240808052639(@swc/helpers@0.5.11)': dependencies: '@module-federation/runtime-tools': 0.2.3 - '@rspack/binding': '@rspack/binding-canary@1.0.0-canary-338cfbe-20240731183605' - '@rspack/lite-tapable': '@rspack/lite-tapable-canary@1.0.0-canary-338cfbe-20240731183605' + '@rspack/binding': '@rspack/binding-canary@1.0.0-canary-af0452f-20240808052639' + '@rspack/lite-tapable': '@rspack/lite-tapable-canary@1.0.0-canary-af0452f-20240808052639' caniuse-lite: 1.0.30001649 optionalDependencies: '@swc/helpers': 0.5.11 - '@rspack/lite-tapable-canary@1.0.0-canary-338cfbe-20240731183605': {} + '@rspack/lite-tapable-canary@1.0.0-canary-af0452f-20240808052639': {} '@rspack/lite-tapable@1.0.0-beta.2': {}