【问题标题】:Is it possible to export to body of two different files from main.js?是否可以从 main.js 导出到两个不同文件的主体?
【发布时间】:2022-02-13 10:12:17
【问题描述】:

我想将组件从 main.js 导出到多个文件,如下所示:

main.js:

import Block1 from './Block1.svelte';
import Block2 from './Block2.svelte';

export const Block1  = new Block1({ target: document.body}); //to index.html 
export const Block2  = new Block2({ target: document.body}); //to index2.html 

svelt js中如何将多个.html文件编译到公共目录?

【问题讨论】:

    标签: javascript reactive-programming svelte svelte-component


    【解决方案1】:

    我找到了这个存储库:

    https://github.com/Tom-Siegel/multi-page-svelte

    效果很好,可以添加多个页面作为输入

    const inputs = [
      "main", //string defaults to input: src/[name].js and output: public/build/[name].js
      {
        input: "src/second.js",
        output: { file: "public/build/second.js", name: "second" },
        css: "public/build/second.css",
      }, //object for setting more specific values for input and output of roolup configuration
    ];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多