@tuya-sat/micro-script 2.1.3 → 2.2.5

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.
@@ -19,6 +19,7 @@ const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plug
19
19
  const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
20
20
  const css_minimizer_webpack_plugin_1 = __importDefault(require("css-minimizer-webpack-plugin"));
21
21
  const micro_dev_loader_1 = require("@tuya-sat/micro-dev-loader");
22
+ const micro_utils_1 = require("@tuya-sat/micro-utils");
22
23
  const paths_1 = __importDefault(require("./paths"));
23
24
  function getCommonConfig({ isDev, isBuild, }) {
24
25
  const { name: packageName } = require(paths_1.default.appPkg);
@@ -79,7 +80,16 @@ function getCommonConfig({ isDev, isBuild, }) {
79
80
  test: /\.less$/,
80
81
  use: getStyleLoaders({
81
82
  importLoaders: 1,
82
- }, require.resolve("less-loader")),
83
+ }, {
84
+ loader: require.resolve("less-loader"),
85
+ options: {
86
+ lessOptions: Object.assign(Object.assign({}, (process.env.MICRO_THEME
87
+ ? {
88
+ modifyVars: Object.assign(Object.assign({}, micro_utils_1.theme.getAntdOverWriteFile().light), { "entry-name": "light" }),
89
+ }
90
+ : {})), { javascriptEnabled: true }),
91
+ },
92
+ }),
83
93
  },
84
94
  {
85
95
  test: /\.(scss|sass)$/,
@@ -104,26 +114,26 @@ function getCommonConfig({ isDev, isBuild, }) {
104
114
  optimization: {
105
115
  runtimeChunk: "single",
106
116
  splitChunks: {
107
- cacheGroups: {
108
- // vendorCss: {
109
- // test: /(\/node_modules\/[\s\S]+(.less|.css)$)|(\/src\/styles\/global.less)/,
110
- // name: "light",
111
- // chunks: "all",
112
- // priority: 2,
113
- // },
114
- vendor: {
117
+ cacheGroups: Object.assign(Object.assign({}, (process.env.MICRO_THEME
118
+ ? {
119
+ vendorCss: {
120
+ test: /([\\/]node_modules[\\/][\s\S]+(.less|.css)$)|([\\/]src[\\/]styles[\\/]global.less)/,
121
+ name: "light",
122
+ chunks: "all",
123
+ priority: 2,
124
+ },
125
+ }
126
+ : {})), { vendor: {
115
127
  test: /[\\/]node_modules[\\/]/,
116
128
  name: "vendors-others",
117
129
  chunks: "all",
118
130
  priority: 0,
119
- },
120
- react: {
131
+ }, react: {
121
132
  test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
122
133
  name: "react-related",
123
134
  chunks: "all",
124
135
  priority: 1,
125
- },
126
- },
136
+ } }),
127
137
  },
128
138
  minimizer: ["...", new css_minimizer_webpack_plugin_1.default()],
129
139
  },
@@ -146,7 +156,7 @@ function getCommonConfig({ isDev, isBuild, }) {
146
156
  filename: "static/css/[name].[contenthash:8].css",
147
157
  chunkFilename: "static/css/[name].[contenthash:8].chunk.css",
148
158
  }),
149
- isBuild && false && new micro_dev_loader_1.ThemePlugin(),
159
+ isBuild && process.env.MICRO_THEME && new micro_dev_loader_1.ThemePlugin(),
150
160
  ].filter((value) => Boolean(value)),
151
161
  };
152
162
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-sat/micro-script",
3
- "version": "2.1.3",
3
+ "version": "2.2.5",
4
4
  "bin": "./dist/bin/cli.js",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
@@ -20,9 +20,9 @@
20
20
  "@babel/preset-react": "7.16.7",
21
21
  "@babel/preset-typescript": "7.16.7",
22
22
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
23
- "@tuya-sat/micro-dev-loader": "2.1.3",
24
- "@tuya-sat/micro-dev-proxy": "2.1.3",
25
- "@tuya-sat/micro-utils": "2.1.3",
23
+ "@tuya-sat/micro-dev-loader": "2.2.5",
24
+ "@tuya-sat/micro-dev-proxy": "2.2.5",
25
+ "@tuya-sat/micro-utils": "2.2.5",
26
26
  "babel-loader": "8.2.4",
27
27
  "babel-plugin-import": "1.13.3",
28
28
  "chalk": "4.1.2",