2017-03-21 5 views
2

webpack을 사용하여 일부 부풀과 기타 CSS 파일을 하나로 묶습니다. 다음은 입니다. webpack.config.js 파일 var htmlWebPack = require ('html-webpack-plugin'); var ExtractTextPlugin = require ("extract-text-webpack-plugin");Webpack for Bootstrap을 사용하는 방법?

module.exports = { 
    entry: "./app/main.ts", 
    output: { 
     path: __dirname + '/dist', 
     filename: "bundle.js" 
    }, 
    resolve: { 
    extensions: ['.js','.ts'] 
    }, 
    module: { 
     loaders: [ 
      { 
       test: /\.tsx?$/, 
       loader: 'awesome-typescript-loader' 
      }, 
      { 
     test: /\.css$/, 
     use: ExtractTextPlugin.extract({ 
      fallback: "style-loader", 
      use: "css-loader" 
     }) 
     }, 
     { 
      test: /\.(png|woff|woff2|eot|ttf|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, 
      loader: 'url-loader' } 
     ] 
    }, 
    plugins: [ 
    new htmlWebPack({ 
     template: './index.html', 

    }), 
     new ExtractTextPlugin("minified-style.css"), 
    ] 

}; 

와 내가 main.ts 내 부트 스트랩 폴더를 참조한이

require('../Content/bootstrap/bootstrap.min.css'); 
require('../Content/bootstrap/bootstrap-theme.min.css'); 

같은 파일하지만 난 웹팩을 실행할 때, 나는이

D:\project\angularControls\angularControls\node_modules\loader-runner\lib\loadLoader.js:35

throw new Error("Module '" + loader.path + "' is not a loader (must have normal or pitch function)");

^ Error: Module 'D:\project\angularControls\angularControls\node_modules\url\url.js'

is not a loader (must have normal or pitch function)

같은 오류 무언가를 얻고있다 무슨 일이 일어나고 있는지 확실하지 않습니다.

답변

1

Webpack은 유연성과 성능 측면에서 먼 길을왔다. 나는 같은 질문을했지만, webpack으로 부트 스트랩을 사용하기위한 모듈을 셋업하는 데 많은 시간을 소비하지는 않았다. 언제든지 GitHub Repo에있는 코드를 방문하십시오.

누군가 도움이되기를 바랍니다.