@empjs/plugin-vue3 3.0.0-beta.1 → 3.0.0-beta.28

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.
Files changed (2) hide show
  1. package/dist/index.js +49 -23
  2. package/package.json +9 -10
package/dist/index.js CHANGED
@@ -6,9 +6,19 @@ export default () => {
6
6
  async rsConfig(store) {
7
7
  const { importResolve, chain } = store;
8
8
  //
9
+ store.merge({
10
+ experiments: {
11
+ rspackFuture: {
12
+ newTreeshaking: true, // 该功能启用了与 webpack 相同的新摇树优化实现,可以生成更高效和更小的代码。
13
+ },
14
+ },
15
+ });
16
+ //
9
17
  // reset
10
- chain.module.rule('javascript').uses.clear().end();
11
- chain.module.rule('typescript').uses.clear().end();
18
+ // chain.module.rule('javascript').uses.clear().end()
19
+ // chain.module.rule('typescript').uses.clear().end()
20
+ chain.module.rule('javascript').test(/\.js$/);
21
+ chain.module.rule('typescript').test(/\.ts$/);
12
22
  // plugin
13
23
  chain.plugin('vue-loader-plugin').use(VueLoaderPlugin, []);
14
24
  // module
@@ -26,17 +36,17 @@ export default () => {
26
36
  .end();
27
37
  //jsx and tsx compile
28
38
  chain.module
29
- .rule('vue-jsx-tsx')
39
+ .rule('vue-jtsx')
30
40
  // .test(/\.(js|jsx|ts|tsx)$/)
31
41
  .test(/\.(jsx|tsx)$/)
32
42
  .use('babel-loader')
33
- .loader(importResolve('babel-loader'))
43
+ .loader(importResolve('babel-loader', import.meta.url))
34
44
  .options({
35
45
  presets: [
36
46
  [
37
47
  importResolve('@babel/preset-typescript', import.meta.url),
38
48
  {
39
- isTSX: true,
49
+ isTSX: true, // allExtensions依赖isTSX https://babeljs.io/docs/en/babel-preset-typescript#allextensions
40
50
  allExtensions: true, // 支持所有文件扩展名
41
51
  },
42
52
  ],
@@ -44,6 +54,20 @@ export default () => {
44
54
  plugins: [[importResolve('@vue/babel-plugin-jsx', import.meta.url), { optimize: true }]],
45
55
  })
46
56
  .end();
57
+ // define
58
+ store.chain.plugin('definePlugin').tap(args => {
59
+ // https://link.vuejs.org/feature-flags
60
+ const o = {
61
+ __VUE_OPTIONS_API__: true,
62
+ __VUE_PROD_DEVTOOLS__: false,
63
+ __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false,
64
+ };
65
+ args[0] = {
66
+ ...o,
67
+ ...args[0],
68
+ };
69
+ return args;
70
+ });
47
71
  // chain config
48
72
  store.chain.merge({
49
73
  module: {
@@ -52,24 +76,26 @@ export default () => {
52
76
  type: 'asset/resource',
53
77
  },
54
78
  // vue js and ts compile
55
- vuejs: {
56
- test: /\.(js|ts)$/,
57
- use: [
58
- {
59
- loader: 'builtin:swc-loader',
60
- options: {
61
- jsc: {
62
- parser: {
63
- syntax: 'typescript',
64
- decorators: true,
65
- tsx: true,
66
- dynamicImport: true,
67
- },
68
- },
69
- },
70
- },
71
- ],
72
- },
79
+ // vuejs: {
80
+ // test: /\.(js|ts)$/,
81
+ // exclude: store.empConfig.moduleTransformRule,
82
+ // sideEffects: false, // 标记模块是否存在副作用。
83
+ // use: [
84
+ // {
85
+ // loader: 'builtin:swc-loader',
86
+ // options: {
87
+ // jsc: {
88
+ // parser: {
89
+ // syntax: 'typescript',
90
+ // decorators: true,
91
+ // tsx: true,
92
+ // dynamicImport: true,
93
+ // },
94
+ // },
95
+ // },
96
+ // },
97
+ // ],
98
+ // },
73
99
  },
74
100
  },
75
101
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empjs/plugin-vue3",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.28",
4
4
  "description": "emp vue3 plugin",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,11 +29,11 @@
29
29
  ".": "./dist/index.js"
30
30
  },
31
31
  "scripts": {
32
- "dev": "rimraf dist && pnpm run /^esdev:.*/",
33
- "esdev:tsc": "tsc -w",
34
- "esdev:tsc-alias": "tsc-alias -w",
35
- "build": "rimraf dist && pnpm run /^esbuild:.*/",
36
- "esbuild:ts": "tsc && tsc-alias"
32
+ "dev": "rimraf dist && pnpm run /^dev:.*/",
33
+ "dev:tsc": "tsc -w",
34
+ "dev:tsc-alias": "tsc-alias -w",
35
+ "build": "rimraf dist && pnpm run /^build:.*/",
36
+ "build:ts": "tsc && tsc-alias"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=20.0.0"
@@ -45,11 +45,10 @@
45
45
  "tsc-alias": "^1.8.8"
46
46
  },
47
47
  "dependencies": {
48
- "@babel/preset-typescript": "^7.23.3",
49
- "@vue/babel-plugin-jsx": "^1.2.1",
48
+ "@babel/preset-typescript": "^7.24.1",
49
+ "@vue/babel-plugin-jsx": "^1.2.2",
50
50
  "babel-loader": "^9.1.3",
51
- "swc-plugin-vue-jsx": "^0.3.0",
52
- "vue": "^3.4.20",
51
+ "vue": "^3.4.21",
53
52
  "vue-loader": "^17.4.2"
54
53
  }
55
54
  }