2017-03-27 36 views
0

我以「傳統方式」創建了一個小項目,我想集成webpack。該項目使用angularjs和bootstrap。如何將webpack集成到傳統結構項目中?

我不想修改我的代碼庫。我僅捆綁js文件。

module.exports = { 
    entry: { 
     app: './src/main.js', 
     others: ['...', '...'] 
     vendor: [ 
      'jquery', 
      'bootstrap', 
      'angular', 
      'angular-route' 
     ] 
    }, 
    output: { 
     path: path.join(__dirname, 'dist'), 
     filename: '[name].bundle.js' 
    }, 
    plugins: [ 
     new webpack.ProvidePlugin({ 
      '$': 'jquery', 
      'jQuery': 'jquery', 
      'window.jQuery': 'jquery' 
     }) 
]} 

在index.html的我只是包括app.bundle.js,others.bundle.js和vendor.bundle.js。

構建工程。但當然,引導js代碼不會被執行(所以導航欄切換不適用於小設備)。有沒有辦法使它與引導工作?我必須要求/進口bootstrap嗎?

回答

0

嘗試尋找here

你確定一切正常與基準從 HTML文件來引導?


我剛剛看到你寫了你沒有添加從你的HTML引導引導。我認爲這可能是問題

相關問題