如何使用保险丝盒设置多页项目?

时间:2017-10-30 22:15:41

标签: bundle

我无法导入fusebox项目中的文件并继续看到以下错误:

  

获取http://localhost:4444/hello.ts 404(未找到)

我已正确设置了导入语句,但不明白导致错误的原因。我的项目结构如下所示:

enter image description here

配置文件:

Sparky.task("config", () => {
    fuse = FuseBox.init({
        homeDir: "src",
        output: "dist/$name.js",
        hash: isProduction,
        sourceMaps: !isProduction,
        plugins: [
            [SassPlugin(), CSSPlugin()],
            CSSPlugin(),
            WebIndexPlugin({ 
                target: "index.html",
                template: "src/index.html"
            }),
            WebIndexPlugin({ 
                target: "login.html",
                template: "src/login.html"
            }),
            isProduction && UglifyJSPlugin()
        ],

    });  

    // vendor should come first
    vendor = fuse.bundle("vendor")
        .instructions("~ js/indexView.ts"); 

    // out main bundle
    app = fuse.bundle("app")
        .instructions(`!> js/indexView.ts`);

    if (!isProduction) {
        fuse.dev();
    }
});

Hello.ts:

export function hello(name: string) {
    return `Hello ${name}`;
}

IndexView.ts:

import {hello} from "./hello.ts";

const message: string = `This is the index page`;
console.log(hello(message));

您还可以找到此项目here on Github

0 个答案:

没有答案