Is there a replacement for Vue CLI's conditional "require"? #2915
-
In the Vue CLI you can conditionally import a file using How it's done with Vue CLI import { createApp } from 'vue'
import App from './App.vue'
// NEW
if (process.env.NODE_ENV === 'development') {
const { worker } = require('./mocks/browser')
worker.start()
}
createApp(App).mount('#app') |
Beta Was this translation helpful? Give feedback.
Answered by
Shinigami92
Apr 8, 2021
Replies: 1 comment 1 reply
-
Try |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Jaeiya
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try
import.meta.env.PROD
andawait import('./mocks/browser')