Skip to content

Commit 3323a4f

Browse files
fix: vite crashed while reading import.meta.env
1 parent 483aee0 commit 3323a4f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: plugins/ownSourceMetaPlugin.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export default () => ({
1414
instance.nodeIndex.forEach(node => {
1515
if (!node.file.stat.isDirectory())
1616
node.meta.src = tools.split(
17-
readFileSync(node.file.path, 'utf-8'),
17+
// vite fix. vite does not like import.meta.env as it will be replaced by vite with the actual env variables
18+
readFileSync(node.file.path, 'utf-8').replace(/import\.meta\.env/, ''),
1819
routifyDir + '/ownSourcePlugin/' + node.file.path + '.src.js',
1920
)
2021
})

0 commit comments

Comments
 (0)