无法在角度2 webpack 2中加载块

时间:2017-05-14 09:58:34

标签: javascript angular webpack

你有一个块映射到/ cart / route,当我尝试加载它时,chrome throws

Not allowed to load local resource: file:///D:/MyProject/dist/js0.chunk.js错误。

除此之外,路径不应该是file:///D:/MyProject/dist/js/0.chunk.js

这是我的webpack.config.js

const path = require('path');

module.exports = {
     cache: true,
     entry: './src/ts/main.ts',
     output: {
         path: path.resolve(__dirname, './dist/js/'),
         publicPath: path.resolve(__dirname, './dist/js/'),
         filename: '[name].bundle.js',
         chunkFilename: '[id].chunk.js'
     },
     resolve: {
         extensions: ['.ts', '.js']
     },
     module: {
         loaders: [{
                 test: /\.ts$/,
                 loaders: ['awesome-typescript-loader', 'angular-router-loader']
             },
             {
                 test: /\.scss$/,
                 loader: "css-loader!sass-loader"
             }
         ]
     },
     devServer: {
         contentBase: './dist'
     }
 };

0 个答案:

没有答案