Skip to content

Instantly share code, notes, and snippets.

@vibhasbhingarde
Created October 25, 2018 05:54
Show Gist options
  • Save vibhasbhingarde/d7b3f30d9850bee514022a0c1fb60be9 to your computer and use it in GitHub Desktop.
Save vibhasbhingarde/d7b3f30d9850bee514022a0c1fb60be9 to your computer and use it in GitHub Desktop.
webpack + boostrap snipplets
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