2016-06-22 3 views
0

Скачайте последнюю версию WEBPACK для Angular 2.0, но без дополнительной библиотеки. Мне нужно добавить в бутстрап WEBPACK (или некоторые другие библиотеки).Как добавить бутстрап на WEBPACK?

webpack.config.js:

var webpack = require('webpack'); 
var path = require('path'); 


// Webpack Config 
var webpackConfig = { 
    entry: { 
    'polyfills': './src/polyfills.ts', 
    'vendor': './src/vendor.ts', 
    'app':  './src/app.ts', 
    }, 

    output: { 
    path: './dist', 
    }, 

    plugins: [ 
    new webpack.optimize.CommonsChunkPlugin({ name: ['app', 'vendor', 'polyfills'], minChunks: Infinity }), 
    ], 

    module: { 
    loaders: [ 
     // .ts files for TypeScript 
     { test: /\.ts$/, loader: 'awesome-typescript-loader' }, 

    ] 
    } 

}; 


// Our Webpack Defaults 
var defaultConfig = { 

    devtool: 'cheap-module-source-map', 
    cache: true, 
    debug: true, 

    output: { 
    filename: '[name].bundle.js', 
    sourceMapFilename: '[name].map', 
    chunkFilename: '[id].chunk.js' 
    }, 

    module: { 
    preLoaders: [{ 
     test: /\.js$/, 
     loader: 'source-map-loader', 
     exclude: [ 
      // these packages have problems with their sourcemaps 
      path.join(__dirname, 'node_modules', 'rxjs'), 
      path.join(__dirname, 'node_modules', '@angular2-material'), 
      path.join(__dirname, 'node_modules', '@angular'), 
     ] 
    }], 
    noParse: [ 
     path.join(__dirname, 'node_modules', 'zone.js', 'dist'), 
     path.join(__dirname, 'node_modules', 'angular2', 'bundles') 
    ] 
    }, 

    resolve: { 
    root: [ path.join(__dirname, 'src') ], 
    extensions: ['', '.ts', '.js'], 
    alias: { 
     'angular2/testing': path.join(__dirname, 'node_modules', '@angular', 'core', 'testing.js'), 
     '@angular/testing': path.join(__dirname, 'node_modules', '@angular', 'core', 'testing.js'), 
     'angular2/core': path.join(__dirname, 'node_modules', '@angular', 'core', 'index.js'), 
     'angular2/platform/browser': path.join(__dirname, 'node_modules', '@angular', 'platform-browser', 'index.js'), 
     'angular2/testing': path.join(__dirname, 'node_modules', '@angular', 'testing', 'index.js'), 
     'angular2/router': path.join(__dirname, 'node_modules', '@angular', 'router', 'index.js'), 
     'angular2/http': path.join(__dirname, 'node_modules', '@angular', 'http', 'index.js'), 
     'angular2/http/testing': path.join(__dirname, 'node_modules', '@angular', 'http', 'testing.js') 
    }, 
    }, 

    devServer: { 
    historyApiFallback: true, 
    watchOptions: { 
     aggregateTimeout: 300, 
     poll: 1000 
    } 
    }, 

    node: { 
    global: 1, 
    crypto: 'empty', 
    module: 0, 
    Buffer: 0, 
    clearImmediate: 0, 
    setImmediate: 0 
    }, 
} 

var webpackMerge = require('webpack-merge'); 
module.exports = webpackMerge(defaultConfig, webpackConfig); 

Ссылка для WebPack: https://github.com/angular/angular2-seed

ответ

0

Вы скачиваете Angular2.0 проекта семена НЕ последнюю WebPack. Если я правильно понимаю, вы хотите добавить бутстрап в этот проект Angular2.0. Используйте npm install для добавления бутстрапа. npm install bootstrap в командной строке. Убедитесь, что вы указали правильный путь к проекту.

Смежные вопросы