2017-08-08 9 views
0

webpack2でASP.NET MVCプロジェクトを実行しようとしています。最初のステップとして、ExtractTextPluginでwebpack2を設定しました。webpack watchを実行すると、ブラウザはピックアップローカルファイルを変更しません

webpack watchを実行すると、バンドルされたCSSファイルが更新されていることがわかります。 しかし、IISExpressでプロジェクトを実行してwebpack watchを実行している場合、ブラウザはファイルが変更されても最新の変更を取得しません。

ウェブパックウォッチをオフにしてブラウザをリフレッシュすると、ブラウザでその変更が確認できます。

私はここで、WebPACKのdevのサーバーなしで実行していますwebpack.config.jsです:

const ExtractTextPlugin = require("extract-text-webpack-plugin"); 
 
const path = require('path'); 
 

 
module.exports = env => { 
 

 
    return { 
 
     entry: { 
 
      "main": "./static/entry.js", 
 
      "component": path.resolve(__dirname, "../component/static/bundle.js") 
 
     }, 
 
     output: { 
 
      path: path.resolve(__dirname, "./static/dist/scripts"), 
 
      filename: "[name].index.js" 
 
     }, 
 
     module: { 
 
      rules: [ 
 
       { 
 
        test: /\.scss$/, 
 
\t \t \t \t  exclude: /node_modules/, 
 
        use:ExtractTextPlugin.extract({ 
 
         fallback: "style-loader", 
 
         use: [ 
 
          { 
 
           loader: 'css-loader', 
 
          }, 
 
          { 
 
           loader: 'sass-loader', 
 
           options: { 
 
            sourceMap: true, 
 
            includePaths: [ 
 
             path.resolve(__dirname, './default.css'), 
 
             path.resolve(__dirname, './normalize.css') 
 
            ] 
 
           } 
 
          } 
 
         ] 
 
        }) 
 
       }, 
 
       { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ }, 
 
       { test: /\.ts$/, loader: 'babel-loader', exclude: /node_modules/ } 
 
      ] 
 
     }, 
 
     plugins: [ 
 
      new webpack.ProvidePlugin({ 
 
       $: path.resolve(__dirname, './node_modules/jquery/src/jquery'), 
 
       jQuery: path.resolve(__dirname, './node_modules/jquery/src/jquery'), 
 
       moment: path.resolve(__dirname, './node_modules/moment/moment') 
 
      }), 
 
      new ExtractTextPlugin({ 
 
       filename: "../style/[name].style.css", 
 
       allChunks: true 
 
      }), 
 
      new webpack.optimize.UglifyJsPlugin({ 
 
       minimize: true, 
 
       compress: { 
 
        warnings: false 
 
       } 
 
      }) 
 
    ] 
 

 
    } 
 

 
};

問題が一定であると私は起きている可能性が何見当がつかない、助けてください。

答えて

0

この問題の原因がわかりました。

プロジェクトweb.configはクライアントリソースをキャッシュし、出力キャッシュを無効にして問題を解決しました。

<caching> 
    <outputCache enableOutputCache="false" /> 
</caching> 
関連する問題