2016-10-09 4 views
0

Ein einfacher Import in index.html funktioniert. Warum der zusätzliche Aufwand? Wie kann ich das Folgende lösen?Webpack, Angular2 und Bootstrap arbeiten nicht zusammen

ich installieren in package.json

"bootstrap":"3.3.7", 

Ich versuche

import '../../node_modules/bootstrap/dist/css/bootstrap.css' 


SyntaxError: Invalid or unexpected token 
    at Object.exports.runInThisContext (vm.js:76:16) 
    at Module._compile (module.js:528:28) 
    at Object.Module._extensions..js (module.js:565:10) 
    at Module.load (module.js:473:32) 
    at tryModuleLoad (module.js:432:12) 
    at Function.Module._load (module.js:424:3) 
    at Module.require (module.js:483:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (/Users/Documents/frontend/-angular2/node_modules/bootstrap/dist/css/bootstrap.css:6:4446) 
    at Module._compile (module.js:556:32) 
    at Object.exec (/Users/Documents/frontend/qangular2/node_modules/webpack/lib/NormalModule.js:94:6) 
    at Object.module.exports (/Users/Documents/frontend/qta-angular2/node_modules/to-string-loader/src/to-string.js:6:54) 
@ ./src/app/app.component.ts 8:0-62 
@ ./src/app/app.module.ts 
@ ./src/app/index.ts 
@ ./src/main.browser.ts 
@ multi main 

Antwort

0

Bootstrap laden sollte es mit der Arbeit nur

import "bootstrap/dist/css/bootstrap.css" tun können Sie die richtige Lader benötigen. Sie können versuchen,

{test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/, loader: 'url-loader?limit=10000', }

Example

Verwandte Themen