From 68722f85b1fa4909859b6d77aa6e045f1682b57b Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Mon, 7 Jan 2019 18:04:56 -0200 Subject: [PATCH] Fix rollup alias --- tools/rollup/config.component.watch.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tools/rollup/config.component.watch.js b/tools/rollup/config.component.watch.js index 12c2a379..06cf54c6 100644 --- a/tools/rollup/config.component.watch.js +++ b/tools/rollup/config.component.watch.js @@ -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'; @@ -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__: `