@modern-js/plugin-swc 2.10.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @modern-js/core
2
2
 
3
+ ## 2.12.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [c2ca6c8]
8
+ - Updated dependencies [6d86e34]
9
+ - @modern-js/utils@2.12.0
10
+ - @modern-js/builder-plugin-swc@2.12.0
11
+
12
+ ## 2.11.0
13
+
14
+ ### Patch Changes
15
+
16
+ - ca0c043: fix(plugin-swc): add warning when using esbuild with SWC
17
+
18
+ fix(plugin-swc): 在同时启用 SWC 和 esbuild 时抛出 warning
19
+
20
+ - Updated dependencies [cfb058f]
21
+ - Updated dependencies [0bd018b]
22
+ - Updated dependencies [c6a94c7]
23
+ - Updated dependencies [a8c08c3]
24
+ - Updated dependencies [5d624fd]
25
+ - Updated dependencies [e2466a1]
26
+ - Updated dependencies [02bb383]
27
+ - Updated dependencies [381a3b9]
28
+ - Updated dependencies [99693f0]
29
+ - Updated dependencies [7a60f10]
30
+ - Updated dependencies [274b2e5]
31
+ - Updated dependencies [b9e1c54]
32
+ - @modern-js/utils@2.11.0
33
+ - @modern-js/builder-plugin-swc@2.11.0
34
+
3
35
  ## 2.10.0
4
36
 
5
37
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("@modern-js/utils");
4
4
  const builder_plugin_swc_1 = require("@modern-js/builder-plugin-swc");
5
+ const logger_1 = require("@modern-js/utils/logger");
5
6
  exports.default = () => ({
6
7
  name: '@modern-js/plugin-swc',
7
8
  setup: api => ({
@@ -10,9 +11,19 @@ exports.default = () => ({
10
11
  },
11
12
  prepare() {
12
13
  const context = api.useAppContext();
13
- if (context.builder) {
14
- const config = api.useResolvedConfigContext();
15
- context.builder.addPlugins([(0, builder_plugin_swc_1.builderPluginSwc)(config.tools.swc)]);
14
+ if (!context.builder) {
15
+ return;
16
+ }
17
+ const config = api.useResolvedConfigContext();
18
+ const { esbuild, swc = {} } = config.tools;
19
+ context.builder.addPlugins([(0, builder_plugin_swc_1.builderPluginSwc)(swc)]);
20
+ if (esbuild) {
21
+ if (swc.jsMinify !== false && esbuild.minimize !== false) {
22
+ logger_1.logger.warn('You have enabled both esbuild minimizer and SWC minimizer, which will cause conflicts. Please remove `tools.esbuild` config and only use SWC to minimize your code.');
23
+ }
24
+ if (esbuild.loader !== false) {
25
+ logger_1.logger.warn('You have enabled both esbuild loader and SWC loader, which will cause conflicts. Please remove `tools.esbuild` config and only use SWC to transform your code.');
26
+ }
16
27
  }
17
28
  },
18
29
  }),
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "modern",
11
11
  "modern.js"
12
12
  ],
13
- "version": "2.10.0",
13
+ "version": "2.12.0",
14
14
  "jsnext:source": "./src/index.ts",
15
15
  "types": "./dist/index.d.ts",
16
16
  "main": "./dist/index.js",
@@ -26,19 +26,19 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@modern-js/builder-plugin-swc": "2.10.0",
30
- "@modern-js/utils": "2.10.0"
29
+ "@modern-js/builder-plugin-swc": "2.12.0",
30
+ "@modern-js/utils": "2.12.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/jest": "^29",
34
34
  "@types/node": "^14",
35
35
  "typescript": "^4",
36
- "@modern-js/app-tools": "2.10.0",
37
- "@modern-js/builder-shared": "2.10.0",
38
- "@modern-js/babel-preset-app": "2.10.0",
39
- "@modern-js/types": "2.10.0",
40
- "@scripts/build": "2.10.0",
41
- "@scripts/jest-config": "2.10.0"
36
+ "@modern-js/app-tools": "2.12.0",
37
+ "@modern-js/builder-shared": "2.12.0",
38
+ "@modern-js/babel-preset-app": "2.12.0",
39
+ "@modern-js/types": "2.12.0",
40
+ "@scripts/build": "2.12.0",
41
+ "@scripts/jest-config": "2.12.0"
42
42
  },
43
43
  "publishConfig": {
44
44
  "registry": "https://registry.npmjs.org/",