Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rollup supports now vue "@" alias - e.g. '@/components/HelloWorld.vue' #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
},
"devDependencies": {
"@mdi/font": "^4.6.95",
"@rollup/plugin-alias": "^3.1.0",
"@rollup/plugin-node-resolve": "^6.0.0",
"@types/node": "^12.12.14",
"@vue/cli-plugin-babel": "^4.1.1",
Expand Down
16 changes: 16 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ import resolve from '@rollup/plugin-node-resolve';
import del from 'rollup-plugin-delete'
import css from 'rollup-plugin-css-porter';
import sass from 'rollup-plugin-sass';
import alias from '@rollup/plugin-alias'
import path from 'path'

const projectRootDir = path.resolve(__dirname)
const customResolver = resolve({
extensions: ['.ts', '.js', '.vue', '.sass', '.scss']
})

export default {
input: 'src/index.ts', // our source file
Expand Down Expand Up @@ -91,6 +98,15 @@ export default {
}),
sass(),
css(),
alias({
entries: [
{
find: '@',
replacement: path.resolve(projectRootDir, 'src'),
}
],
customResolver,
}),
resolve(),
// terser() // minifies generated bundles

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import Vuetify, { VBtn } from 'vuetify/lib';
import Vue from 'vue';
import HelloWorld from './components/HelloWorld.vue';
import HelloWorld from '@/components/HelloWorld.vue';

/**
* Fügt eine "install" function bei MLiveForce hinzu
Expand Down