2016-04-28 10 views
1

私はwebpackプラグインをVisual Studioにインストールしました。その実行中に時計モードを使用する場合を除いて、常にうまく動作します。それは通常の実行オプションで動作しますが、変更するたびにそれを使用するのに時間がかかります。また、実行オプションは、変更されたエントリポイントだけでなく、すべてのエントリポイントを作成します。ウェブパックの監視モードは、ビジュアルスタジオ2015の実行中に例外になります

私は例外を取得行います

InvalidOperationExceptionがは「System.InvalidOperationException」種類の未処理の例外がmscorlib.dllが

で発生し、それがブレークモードに入る

未処理でした。

アプリケーションがブレークモードになっています あなたのアプリケーションはブレーク状態になりましたが、すべてのスレッドが外部コード(通常はシステムコードまたはフレームワークコード)を実行していたため表示するコードはありません。

私はいくつかの助け

/// <binding Clean='Watch - Development' /> 
 

 
AssetsPlugin = require('assets-webpack-plugin'); 
 
path = require('path'); 
 
pkg = require('./package.json'); 
 
webpack = require('webpack'); 
 

 

 
var production = process.env.NODE_ENV === 'production'; 
 
var config = require("./webpack.config.js"); 
 
BUILD_DIRECTORY = 'build'; 
 
BUILD_DROP_PATH = path.resolve(__dirname, BUILD_DIRECTORY); 
 
CHUNK_FILE_NAME = '[name].js'; 
 
WEB_ROOT = path.resolve(__dirname, 'Scripts/WS2'); 
 

 

 
module.exports = { 
 
    context: WEB_ROOT, 
 
    entry: { 
 
     ITOps_ProfilePage_ShowPage: "./ItOps/Pages/ProfilePage/ProfilePage", 
 
     ITOps_TestPage_ShowPage: "./ItOps/Pages/TestPage/TestPage", 
 
     LayoutWS2: './Common/LayoutWS2', 
 
     vendor: Object.keys(pkg.dependencies) 
 
    }, 
 
    output: { 
 
     chunkFilename: CHUNK_FILE_NAME, 
 
     filename: CHUNK_FILE_NAME, 
 
     libraryTarget: 'var', 
 
     publicPath:'/build/', 
 
     path: BUILD_DROP_PATH 
 
    }, 
 
    module: { 
 
     loaders: [ 
 
      { 
 
       test: /\.js$/, 
 
       loader: 'babel-loader', 
 
       include: [ 
 
        path.resolve(__dirname, 'Scripts/WS2'), 
 
        path.resolve(__dirname, 'node_modules', 'prosemirror') 
 
       ], 
 
       // Need this here for prosemirror til it has own .babelrc 
 
       query: { 
 
        presets: ['es2015-webpack'], 
 
        plugins: [ 
 
         ["transform-es2015-modules-commonjs-simple", { 
 
          noMangle: true 
 
         }] 
 
        ] 
 
        
 
       } 
 
      }, 
 
      { test: /\.css$/, loader: "style-loader!css-loader" }, 
 
      { test: /\.html/, loader: 'html' }, 
 
      { test: /\.(png|gif|jpe?g|svg)$/i, loader: 'url?limit=10000' }, 
 
      { test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/font-woff' }, 
 
      { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/octet-stream' }, 
 
      { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file' }, 
 
      { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml' } 
 
     ], 
 
    }, 
 
    plugins: [ 
 
     new AssetsPlugin({ 
 
      filename: 'webpack.assets.json', 
 
      path: BUILD_DROP_PATH, 
 
      prettyPrint: true 
 
     }), 
 
     new webpack.optimize.CommonsChunkPlugin(/* chunkName= */"vendor", /* filename= */"vendor.js"), 
 
     new webpack.ProvidePlugin({ 
 
      $: "jquery", 
 
      jQuery: "jquery" 
 
     }) 
 

 
    ], 
 

 
    if (production) { 
 
     plugins = plugins.concat([ 
 

 
      // This plugin looks for similar chunks and files 
 
      // and merges them for better caching by the user 
 
      new webpack.optimize.DedupePlugin(), 
 

 
      // This plugins optimizes chunks and modules by 
 
      // how much they are used in your app 
 
      new webpack.optimize.OccurenceOrderPlugin(), 
 

 
      // This plugin prevents Webpack from creating chunks 
 
      // that would be too small to be worth loading separately 
 
      new webpack.optimize.MinChunkSizePlugin({ 
 
       minChunkSize: 51200, // ~50kb 
 
      }), 
 

 
      // This plugin minifies all the Javascript code of the final bundle 
 
      new webpack.optimize.UglifyJsPlugin({ 
 
       mangle: true, 
 
       comments: false, 
 
       compress: { 
 
        warnings: false, // Suppress uglification warnings 
 
       }, 
 
      }), 
 

 
      // This plugins defines various variables that we can set to false 
 
      // in production to avoid code related to them from being compiled 
 
      // in our final bundle 
 
      new webpack.DefinePlugin({ 
 
       __SERVER__: !production, 
 
       __DEVELOPMENT__: !production, 
 
       __DEVTOOLS__: !production, 
 
       'process.env': { 
 
        BABEL_ENV: JSON.stringify(process.env.NODE_ENV), 
 
       }, 
 
      }), 
 

 
     ]); 
 
    } 
 
};

+0

こんにちは@ stian64。診断に役立つように、あなたのwebpack.configファイルを質問に追加できますか?私はwebpackプラグインで問題を抱えていますが、それは失敗しているのではなく、見ていないということです。 –

+0

確かに私はそれを追加します – stian64

答えて

0

を大好きだ私はあなたのwebpack.configファイルを見て、私は明らかに何かを見ることはできませんが、いくつかの機能/プラグインI避難所を使用しています使用されていません。

これが役立つかどうかわかりませんが、私はではありません。はwebpack watchを動作させます。それは例外をスローしませんでしたが、ファイルに対する変更をキャッチしませんでした。

多くの狩りの後、私はこの古いSO answerを見に行きました。これは古い時計プラグインを使用すると言います。あなたのwebpack.configに以下を追加します。

plugins: [ 
    new webpack.OldWatchingPlugin(), 
    ... other plugins 
], 

注:私は2015年

が、これは物事を修正する場合は、私に教えてくださいのVisual StudioでのWebPACKバージョン1.12.15を使用しています。

PS。 Visual Studioで腕時計に問題がある人は、未亡人のパスのWebPack TroubleShooting Guideを読んでください。

+0

それは素晴らしい仕事をありがとう! – stian64

+0

良いそれが助けてくれてうれしい。エラーに関するフィードバックはほとんどありませんでした。 –

+0

それは、それが3-4回クラッシュしないように助けてくれるようです。変更が発生するとクラッシュし、ブレークモードになります – stian64

関連する問題