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

col*_*ico 7 rollupjs svelte

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

import MyComp from "path/MyComp"
Run Code Online (Sandbox Code Playgroud)

MyComp 文件有.svelte扩展名

Ste*_*aes 16

您可以使用以下命令将解析器添加到您的配置中@rollup/plugin-node-resolve

汇总配置文件

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
   ]
};
Run Code Online (Sandbox Code Playgroud)