lvyjs 0.2.18 → 0.2.19
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/lib/content.js +4 -2
- package/package.json +1 -1
package/lib/content.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { join } from 'path';
|
|
2
1
|
import crypto from 'node:crypto';
|
|
3
2
|
import { convertPath } from './config.js';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { dirname, join } from 'path';
|
|
4
5
|
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
7
|
/**
|
|
6
8
|
* 生成模块内容
|
|
7
9
|
* @param {string} relativePath 相对路径
|
|
@@ -31,7 +33,7 @@ const chache = {};
|
|
|
31
33
|
const generateCSSModuleContent = (relativePath) => {
|
|
32
34
|
const inputURL = decodeURIComponent(relativePath);
|
|
33
35
|
const fileName = getRandomName(inputURL);
|
|
34
|
-
const outputURL = convertPath(join(
|
|
36
|
+
const outputURL = convertPath(join(__dirname, 'assets', `${fileName}.css`));
|
|
35
37
|
if (!chache[inputURL]) {
|
|
36
38
|
global.lvyWorkerProt.postMessage({
|
|
37
39
|
type: 'CSS_MODULE_GENERATED',
|