@cmmn/tools 1.6.24 → 1.6.25

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.
@@ -104,9 +104,9 @@ export class ConfigCreator {
104
104
  template: (x) => {
105
105
  let inject = Object.keys(x.bundle.bundle).map(key => {
106
106
  if (key.endsWith('css'))
107
- return `<link rel="stylesheet" href="/${key}" >`;
107
+ return `<link rel="stylesheet" href="${this.options.base ?? ''}/${key}" >`;
108
108
  if (key.endsWith('js'))
109
- return `<script type="module" defer src="/${key}"></script>`;
109
+ return `<script type="module" defer src="${this.options.base ?? ''}/${key}"></script>`;
110
110
  }).join('\n');
111
111
  if (!this.options.minify) {
112
112
  const importMaps = Object.fromEntries(this.options.external
@@ -116,6 +116,9 @@ export class ConfigCreator {
116
116
  imports: importMaps
117
117
  })}</script>` + inject;
118
118
  }
119
+ if (this.options.base){
120
+ inject = `<base href="${this.options.base}">` + inject;
121
+ }
119
122
  const html = fs.readFileSync(path.join(this.root, this.options.html), 'utf8')
120
123
  return html.replace('</head>', inject + '</head>');
121
124
  }
@@ -277,7 +280,7 @@ export class ConfigCreator {
277
280
 
278
281
  },
279
282
  plugins: this.plugins,
280
- treeshake: this.options.minify ? "smallest" : "safest",
283
+ treeshake: this.options.minify ? "recommended" : "safest",
281
284
  watch: {
282
285
  buildDelay: 300,
283
286
  clearScreen: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmmn/tools",
3
- "version": "1.6.24",
3
+ "version": "1.6.25",
4
4
  "description": "Compilation, bundling, code generator, testing.",
5
5
  "main": "dist/rollup.config.js",
6
6
  "type": "module",
@@ -82,5 +82,5 @@
82
82
  },
83
83
  "author": "",
84
84
  "license": "ISC",
85
- "gitHead": "0826ee58578f567fc9eec12b9ab2aef9d0b3e8a2"
85
+ "gitHead": "69a1243e5836906a3e6e89ed0bfd7543f5a380a8"
86
86
  }