Skip to content

Commit

Permalink
use alias for vue-runtime-helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
diegopf committed Nov 2, 2023
1 parent 7ba4b1d commit fda1ad8
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions packages/x-components/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue2';
import Inspector from 'vite-plugin-vue-inspector';
import packageJSON from './package.json';

const vueDocsPlugin = {
name: 'vue-docs',
Expand All @@ -11,10 +10,6 @@ const vueDocsPlugin = {
}
};

const dependencies = new Set(
Object.keys(packageJSON.dependencies).concat(Object.keys(packageJSON.peerDependencies))
);

export default defineConfig({
plugins: [
vue(),
Expand All @@ -24,29 +19,12 @@ export default defineConfig({
})
],
resolve: {
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
alias: {
'vue-runtime-helpers': 'node_modules/vue-runtime-helpers'
}
},
server: {
port: 8080
},
build: {
rollupOptions: {
external(id) {
/*
Rollup treats by default all node_modules dependencies as external, but will launch a
warning if you don't manually specify them. In our case apart from the package.json ones,
we also need to add any dependency that starts with rxjs (due to rxjs having multiple
entry points), and the vue-runtime-helpers, which is a dependency added by the SFC compiler
*/
return (
dependencies.has(id) || // Package.json dependencies
/* As rxjs has multiple entry points, it needs to be declared this way */
id.startsWith('rxjs') ||
/* Vue SFC dependency. Needs to be here because rollup generates a relative import to the
node_modules folder */
id.includes('vue-runtime-helpers')
);
}
}
}
});

0 comments on commit fda1ad8

Please sign in to comment.