@nocobase/build 1.6.0-alpha.2 → 1.6.0-alpha.21

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/buildPlugin.js +24 -1
  2. package/package.json +2 -2
@@ -307,7 +307,9 @@ async function buildPluginClient(cwd, userConfig, sourcemap, log) {
307
307
  output: {
308
308
  path: outDir,
309
309
  filename: outputFileName,
310
- publicPath: `/static/plugins/${packageJson.name}/dist/client/`,
310
+ chunkFilename: "[chunkhash].js",
311
+ publicPath: `auto`,
312
+ // will be generated by the custom plugin
311
313
  clean: true,
312
314
  library: {
313
315
  name: packageJson.name,
@@ -435,6 +437,27 @@ async function buildPluginClient(cwd, userConfig, sourcemap, log) {
435
437
  new import_core.rspack.DefinePlugin({
436
438
  "process.env.NODE_ENV": JSON.stringify("production")
437
439
  }),
440
+ {
441
+ apply(compiler2) {
442
+ compiler2.hooks.compilation.tap("CustomPublicPathPlugin", (compilation) => {
443
+ compilation.hooks.runtimeModule.tap("CustomPublicPathPlugin", (module2) => {
444
+ if (module2.name === "auto_public_path") {
445
+ module2.source = {
446
+ source: `
447
+ __webpack_require__.p = (function() {
448
+ var publicPath = window['__nocobase_public_path__'] || '/';
449
+ // \u786E\u4FDD\u8DEF\u5F84\u4EE5 / \u7ED3\u5C3E
450
+ if (!publicPath.endsWith('/')) {
451
+ publicPath += '/';
452
+ }
453
+ return publicPath + 'static/plugins/${packageJson.name}/dist/client/';
454
+ })();`
455
+ };
456
+ }
457
+ });
458
+ });
459
+ }
460
+ },
438
461
  process.env.BUILD_ANALYZE === "true" && new import_rspack_plugin.RsdoctorRspackPlugin({
439
462
  // plugin options
440
463
  // supports: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/build",
3
- "version": "1.6.0-alpha.2",
3
+ "version": "1.6.0-alpha.21",
4
4
  "description": "Library build tool based on rollup.",
5
5
  "main": "lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -51,5 +51,5 @@
51
51
  "scripts": {
52
52
  "build": "tsup"
53
53
  },
54
- "gitHead": "08bbc34c21727fc0ad0880f397a42bf7741091ee"
54
+ "gitHead": "873cbaec9554e684781b8dc6cfd4386bb5cfa5b0"
55
55
  }