2017-09-26 4 views
0

私は私のプロジェクトでの輸入のこの種を持っている:私はそれはに含まれないように、外部ライブラリとしてReduxの形式の輸入を作りたいWebPACKを作るReduxの形式の外部ライブラリ

import {Field, reduxForm, FormSection, formValueSelector} from 'redux-form'; 

ビルド。例としては、それはjQueryを使って行われます

externals: { 
    jquery: 'jQuery' 
} 

をそこで質問がWebPACKの中で明示的に列挙することなく、外部と同じライブラリーから複数のインポートを作成する方法についての詳細です。

答えて

0

あなたのWebPACKのconfigにこれを追加しようとすることができます

plugins: [ 
    // split vendor js into its own file 
    new webpack.optimize.CommonsChunkPlugin({ 
     name: 'vendor', 
     minChunks: function (module, count) { 
     // any required modules inside node_modules are extracted to vendor 
     return (
      module.resource && 
      /\.js$/.test(module.resource) && 
      module.resource.indexOf(
      path.join(__dirname, '../node_modules') 
     ) === 0 
     ) 
     } 
    }), 
] 

それはvendorと呼ばれる新しいファイルを作成しますすべての外部ライブラリ

が含まれます
関連する問題