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
}