Skip to content

Commit

Permalink
Fix rollup alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Kaisermann committed Jan 7, 2019
1 parent 32ca4c4 commit 68722f8
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions tools/rollup/config.component.watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import virtual from 'rollup-plugin-virtual';
import livereload from 'rollup-plugin-livereload';
import html from '@gen/rollup-plugin-generate-html';
import replace from 'rollup-plugin-replace';
import alias from 'rollup-plugin-alias';
import image from 'rollup-plugin-url';

import { getPkg } from 'quickenv';
Expand All @@ -31,10 +30,21 @@ export default {
format: 'umd',
},
plugins: [
alias({
resolve: ['.html'],
[`${PKG.name}`]: fromWorkspace(PKG.svelte),
}),
(function aliases() {
const pkgRegExp = new RegExp(`${PKG.name}[\\/](.*)`);

return {
resolveId(importee) {
const match = importee.match(pkgRegExp);
if (!match) {
return null;
}

importee = fromWorkspace(match[1]);
return importee;
},
};
})(),
/** Virtual entry module to bootstrap the example app */
virtual({
__entry__: `
Expand Down

0 comments on commit 68722f8

Please sign in to comment.