@ray-js/builder-web 1.3.99-beta.1 → 1.3.99-beta.2

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/lib/build.js +12 -2
  2. package/package.json +5 -5
package/lib/build.js CHANGED
@@ -51,6 +51,7 @@ const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
51
51
  const webpackbar_1 = __importDefault(require("webpackbar"));
52
52
  const shared_1 = require("@ray-js/shared");
53
53
  const crypto = __importStar(require("crypto"));
54
+ const css_1 = require("@ray-core/cli/lib/build/webpack/config/css");
54
55
  const process_css_1 = require("./loaders/process-css");
55
56
  const process_less_1 = require("./loaders/process-less");
56
57
  function hash(path) {
@@ -176,7 +177,7 @@ function build(options, context) {
176
177
  },
177
178
  });
178
179
  config.performance.hints(false);
179
- config.plugin('defined').use(webpack_1.default.DefinePlugin, [
180
+ config.plugin('webpack-define-plugin').use(webpack_1.default.DefinePlugin, [
180
181
  {
181
182
  'process.env.NODE_ENV': JSON.stringify(mode),
182
183
  'process.env.PLATFORM': JSON.stringify(target),
@@ -233,7 +234,16 @@ function build(options, context) {
233
234
  else {
234
235
  config.set('externals', Object.assign(Object.assign({}, externals), internalExternals));
235
236
  }
236
- api.callPluginMethod('configWebpack', { config });
237
+ const opts = Object.assign(Object.assign({}, compileOptions), { rootDir: compileOptions.source });
238
+ delete opts.source; // ray-core 中 rootDir 等同于 ray-js 中 source
239
+ // todo 未开启 css modules
240
+ api.callPluginMethod('configWebpack', {
241
+ config,
242
+ addCSSRule: (ruleConfig) => {
243
+ (0, css_1.addCSSRule)(config, { options: opts }, true, ruleConfig);
244
+ },
245
+ options: opts
246
+ });
237
247
  if (watch) {
238
248
  const defaultHttpPort = parseInt(port);
239
249
  const httpPort = yield (0, detect_port_1.default)(defaultHttpPort);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/builder-web",
3
- "version": "1.3.99-beta.1",
3
+ "version": "1.3.99-beta.2",
4
4
  "description": "Ray builder for web",
5
5
  "keywords": [
6
6
  "ray"
@@ -21,9 +21,9 @@
21
21
  "watch": "tsc -p ./tsconfig.build.json --watch"
22
22
  },
23
23
  "dependencies": {
24
- "@ray-js/babel-preset-standard": "^1.3.99-beta.1",
25
- "@ray-js/shared": "^1.3.99-beta.1",
26
- "@ray-js/types": "^1.3.99-beta.1",
24
+ "@ray-js/babel-preset-standard": "^1.3.99-beta.2",
25
+ "@ray-js/shared": "^1.3.99-beta.2",
26
+ "@ray-js/types": "^1.3.99-beta.2",
27
27
  "address": "^1.1.2",
28
28
  "autoprefixer": "9.x",
29
29
  "case-sensitive-paths-webpack-plugin": "^2.4.0",
@@ -58,6 +58,6 @@
58
58
  "email": "tuyafe@tuya.com"
59
59
  }
60
60
  ],
61
- "gitHead": "4ca14c16cf1cddfb253c836476558aee405129c2",
61
+ "gitHead": "c129b96e800e9bb062bdbb1236c05cb800fdc34b",
62
62
  "repository": {}
63
63
  }