@plumeria/webpack-plugin 0.15.7 → 0.16.0

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.
package/dist/index.js CHANGED
@@ -112,7 +112,6 @@ class PlumeriaPlugin {
112
112
  }
113
113
  writeCSS() {
114
114
  const css = this.generateOrderedCSS();
115
- fs_1.default.mkdirSync(path_1.default.dirname(this.outFile), { recursive: true });
116
115
  fs_1.default.writeFileSync(this.outFile, css, 'utf-8');
117
116
  }
118
117
  }
@@ -650,6 +650,14 @@ function loader(source) {
650
650
  pluginInstance.registerFileStyles(fileKey, fileStyles);
651
651
  }
652
652
  }
653
+ const useClientRegex = /^(['"])use client\1;?$/;
654
+ const lines = source.split('\n');
655
+ const idx = lines.findIndex((line) => useClientRegex.test(line.trim()));
656
+ if (idx !== -1) {
657
+ lines.splice(idx + 1, 0, 'import "@plumeria/webpack-plugin/zero-virtual.css";');
658
+ const newSource = lines.join('\n');
659
+ return callback(null, newSource);
660
+ }
653
661
  if (callback)
654
662
  callback(null, source + postfix);
655
663
  return source + postfix;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/webpack-plugin",
3
- "version": "0.15.7",
3
+ "version": "0.16.0",
4
4
  "description": "Plumeria Webpack plugin",
5
5
  "repository": {
6
6
  "type": "git",