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

Sign up to get free protection for your applications and to get access to all the features.
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);
@@ -32,7 +32,7 @@ const _PAGES_ = [
32
32
  `;
33
33
  const render = ejs_1.default.compile(routeTml);
34
34
  const readConfigFromConfigFile = (api) => {
35
- const routesConfigFile = api.searchJSFile('src/routes.config');
35
+ const routesConfigFile = api.searchJSFile(`${api.options.source}/routes.config`);
36
36
  if (!routesConfigFile) {
37
37
  throw new Error(`missing configuration file (routes.config.{ts|js})`);
38
38
  }
@@ -53,7 +53,7 @@ function default_1(source) {
53
53
  return __awaiter(this, void 0, void 0, function* () {
54
54
  const cb = this.async();
55
55
  const { api } = this.getOptions();
56
- const routesConfigFile = api.searchJSFile('src/routes.config');
56
+ const routesConfigFile = api.searchJSFile(`${api.options.source}/routes.config`);
57
57
  if (routesConfigFile === this.resourcePath) {
58
58
  const routes = readConfigFromConfigFile(api);
59
59
  const routeWithConfig = routesAdditionConfig(api, routes);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/builder-web",
3
- "version": "1.3.99-beta.0",
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.0",
25
- "@ray-js/shared": "^1.3.99-beta.0",
26
- "@ray-js/types": "^1.3.99-beta.0",
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": "55e5b53442b4d17914c437b101e15e485ec4aebe",
61
+ "gitHead": "c129b96e800e9bb062bdbb1236c05cb800fdc34b",
62
62
  "repository": {}
63
63
  }