Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 网页包+;角2_Typescript_Angular_Webpack - Fatal编程技术网

Typescript 网页包+;角2

Typescript 网页包+;角2,typescript,angular,webpack,Typescript,Angular,Webpack,这个错误是什么意思?将angular2应用程序与网页包捆绑后 “未捕获的语法错误:意外标记 未捕获的语法错误:意外标记 未捕获SyntaxError:意外标记根据我的经验,出现该错误是因为在某些导入中,名称或文件类型错误 您有html导入吗?根据我的经验,出现此错误是因为在某些导入中,名称或文件类型错误 你有html导入吗?检查这个好的Angular2网页包示例 这个github项目演示了如何使用带有Angular2的Webpack,只需最少的配置 下面是这个项目的Webpack配置示例 mo

这个错误是什么意思?将angular2应用程序与网页包捆绑后
“未捕获的语法错误:意外标记 未捕获的语法错误:意外标记
未捕获SyntaxError:意外标记根据我的经验,出现该错误是因为在某些导入中,名称或文件类型错误


您有html导入吗?

根据我的经验,出现此错误是因为在某些导入中,名称或文件类型错误


你有html导入吗?

检查这个好的Angular2网页包示例

这个github项目演示了如何使用带有Angular2的Webpack,只需最少的配置

下面是这个项目的Webpack配置示例

module.exports = {
    entry: "./main.ts",
    output: {
        path: __dirname,
        filename: "./dist/bundle.js"
    },
    resolve : {
        extentions: ['','.js','.ts']
    },
    module: {
        loaders : [{
            test: /\.ts/, loaders : ['ts-loader'],exclude: /node_modules/
        }]
    }
}; 

检查此良好的Angular2网页包示例

这个github项目演示了如何使用带有Angular2的Webpack,只需最少的配置

下面是这个项目的Webpack配置示例

module.exports = {
    entry: "./main.ts",
    output: {
        path: __dirname,
        filename: "./dist/bundle.js"
    },
    resolve : {
        extentions: ['','.js','.ts']
    },
    module: {
        loaders : [{
            test: /\.ts/, loaders : ['ts-loader'],exclude: /node_modules/
        }]
    }
}; 

尝试在模板(HTML)顶部添加

尝试在模板(HTML)顶部添加
.

错误似乎不存在。您的索引看起来如何?您是否在运行时或构建时看到错误?如果是前者,则可能是服务器错误地提供index.html而不是bundle.js,因此浏览器尝试将html评估为js?如果创建了bundle.js,您应该共享它。这可能是c由于任何原因。内部或外部库,因为您正在捆绑整个内容。错误似乎不存在。您的索引看起来如何?您是否在运行时或构建时看到错误?如果是前者,则可能是您的服务器错误地服务于index.html而不是bundle.js,因此浏览器试图删除将html打包为js?如果创建了bundle.js,您应该共享它。这可能是由任何原因造成的。当您打包整个内容时,内部或外部库。