导入省略的svelte组件.svelte扩展名

时间:2019-11-05 16:53:34

标签: rollupjs svelte

是否有可能配置汇总来导入省略了.svelte扩展名的svelte组件?

从“路径/ MyComp”导入MyComp

MyComp文件的扩展名为.svelte

1 个答案:

答案 0 :(得分:2)

您可以使用rollup-plugin-node-resolve将解析器添加到您的配置中:

rollup.config.js

const resolve = require('rollup-plugin-node-resolve'); // add this to the other requires

return {
   ... // the usual things like input, output, ...
   plugins: [
       resolve({
          extensions: ['.svelte', '.js']
       }),
       svelte(),
       ... // any other plugin you are running
   ]
};