I am using webpack to bundle some boostrap and other css files into one, the following is the webpack.config.js file var htmlWebPack = require('html-webpack-plugin'); var ExtractTextPlugin = require("extract-text-webpack-plugin");
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"),
]
};
and i have referenced my bootstrap folder in the main.ts file like this
require('../Content/bootstrap/bootstrap.min.css');
require('../Content/bootstrap/bootstrap-theme.min.css');
but when i run webpack, i am getting the error something like this
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)
not sure what is going wrong.
Webpack has come a long way in terms of flexibility and power. Though i had the same question some time back, didn't take much time to setup a module to use bootstrap with webpack. Feel free to visit the code in GitHub Repo.
Hope it helps someone.