Created
October 25, 2018 05:54
-
-
Save vibhasbhingarde/d7b3f30d9850bee514022a0c1fb60be9 to your computer and use it in GitHub Desktop.
webpack + boostrap snipplets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = env => { | |
entry:'filename.js', | |
output: { | |
filename: "[name].bundle.js", | |
path: path.resolve(__dirname, "dist") | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.m?js$/, | |
exclude: /(node_modules)/, | |
use: { | |
loader: "babel-loader", | |
options: { | |
presets: ["@babel/preset-env"] | |
} | |
} | |
}, | |
// For boostrap fonts and css | |
{ | |
test: /\.css$/, | |
use: ExtractTextPlugin.extract({ | |
fallback: "style-loader", | |
use: [{ loader: "css-loader", options: { minimize: true } }] | |
}) | |
}, | |
{ | |
test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/, | |
loader: "file-loader?limit=1000" | |
} | |
] | |
}, | |
, | |
plugins: [ | |
new webpack.ProvidePlugin({ | |
$: "jquery", | |
jQuery: "jquery", | |
}), | |
new webpack.DefinePlugin({}), // Some constants | |
new ExtractTextPlugin("filename.css"), // bundle css | |
new OptimizeCssAssetsPlugin()] // minify css | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment