@nocobase/build 1.6.0-alpha.6 → 1.6.0-alpha.7

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 +23 -1
  2. package/package.json +2 -2
@@ -308,7 +308,8 @@ async function buildPluginClient(cwd, userConfig, sourcemap, log) {
308
308
  path: outDir,
309
309
  filename: outputFileName,
310
310
  chunkFilename: "[chunkhash].js",
311
- publicPath: `/static/plugins/${packageJson.name}/dist/client/`,
311
+ publicPath: `auto`,
312
+ // will be generated by the custom plugin
312
313
  clean: true,
313
314
  library: {
314
315
  name: packageJson.name,
@@ -436,6 +437,27 @@ async function buildPluginClient(cwd, userConfig, sourcemap, log) {
436
437
  new import_core.rspack.DefinePlugin({
437
438
  "process.env.NODE_ENV": JSON.stringify("production")
438
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
+ },
439
461
  process.env.BUILD_ANALYZE === "true" && new import_rspack_plugin.RsdoctorRspackPlugin({
440
462
  // plugin options
441
463
  // supports: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/build",
3
- "version": "1.6.0-alpha.6",
3
+ "version": "1.6.0-alpha.7",
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": "485580ad30e5164ead7e15f3b4d219f2bce2caf4"
54
+ "gitHead": "d9552440f5e3ce2795c9f2f23a1b04f5376a1550"
55
55
  }