Closed nntam2013 closed 2 years ago
I was trying to migrate from vue-cli to vite, but all my SFC doesn't work expectedly. My config:
export default defineConfig({ plugins: [ vue({ jsx: true, vueTemplateOptions: { compilerOptions: { whitespace: 'preserve', }, }, }), ], server: { port: 8080, host: '0.0.0.0', }, resolve: { alias: { web3: path.resolve(__dirname, './node_modules/web3/dist/web3.min.js'), '@': path.resolve(__dirname, './src'), vue: require.resolve('vue/dist/vue.js'), }, extensions: ['.esm.js', '.cjs.js', '.js', '.ts', '.jsx', '.tsx', '.json'], }, define: { // global: 'globalThis', 'process.env': {}, }, optimizeDeps: { esbuildOptions: { // Node.js global to browser globalThis define: { global: 'globalThis', }, // Enable esbuild polyfill plugins plugins: [ NodeGlobalsPolyfillPlugin({ process: true, buffer: true, }), NodeModulesPolyfillPlugin(), ], }, }, build: { rollupOptions: { plugins: [ // Enable rollup polyfills plugin // used during production bundling rollupNodePolyFill(), ], }, }, })
I was trying to migrate from vue-cli to vite, but all my SFC doesn't work expectedly. My config: