Skip to content

Commit 74a8054

Browse files
Merge pull request #21116 from emberjs/copilot/sub-pr-21115
Fix Firefox test build: add `import.meta.env?.DEV` replacement plugin to vite.config.mjs
2 parents 8231942 + 462a664 commit 74a8054

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

vite.config.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ export default defineConfig(({ mode }) => {
3434
return {
3535
plugins: [
3636
templateTag(),
37+
{
38+
name: 'define custom import.meta.env',
39+
transform(code) {
40+
if (mode === 'development') {
41+
if (code.includes('import.meta.env?.DEV')) {
42+
return code.replace(/import.meta.env\?.DEV/g, 'true');
43+
}
44+
} else if (mode === 'production') {
45+
if (code.includes('import.meta.env?.DEV')) {
46+
return code.replace(/import.meta.env\?.DEV/g, 'false');
47+
}
48+
}
49+
return undefined;
50+
},
51+
},
3752
babel({
3853
babelHelpers: 'bundled',
3954
extensions: ['.js', '.ts', '.gjs', '.gts'],

0 commit comments

Comments
 (0)