Skip to content

Instantly share code, notes, and snippets.

@hasangenc0
Created June 13, 2021 20:06
Show Gist options
  • Save hasangenc0/4a714ba88fc7b7a18bf3a75f4019ffd9 to your computer and use it in GitHub Desktop.
Save hasangenc0/4a714ba88fc7b7a18bf3a75f4019ffd9 to your computer and use it in GitHub Desktop.
const externals = {
react: 'React',
'react-dom': 'ReactDOM',
axios: 'axios',
};
export default defineConfig({
...
build: {
rollupOptions: {
external: Object.keys(externals),
...
},
commonjsOptions: {
ignore: Object.keys(externals),
esmExternals: Object.keys(externals),
},
...
},
optimizeDeps: {
exclude: Object.keys(externals), // optional, just excludes for pre-bundling
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment