2022-10-20 14:10:47 +00:00
|
|
|
// Makes Sass faster!
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
// Our "entry" point
|
2022-11-02 10:57:45 +00:00
|
|
|
entry: {
|
2022-11-09 09:18:41 +00:00
|
|
|
main: './src/blog_assets/js/index.js',
|
|
|
|
print: './src/blog_assets/js/print.js'
|
2022-11-02 10:57:45 +00:00
|
|
|
},
|
2022-10-20 14:10:47 +00:00
|
|
|
output: {
|
|
|
|
// The global variable name any `exports` from `index.js` will be available at
|
|
|
|
library: 'SITE',
|
|
|
|
// Where webpack will compile the assets
|
|
|
|
path: path.resolve(__dirname, 'src/compiled-assets'),
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
// Transpile and polyfill our JavaScript
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
use: 'babel-loader',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// Setting up compiling our Sass
|
|
|
|
test: /\.scss$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: MiniCssExtractPlugin.loader,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
url: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
|
|
|
options: {
|
|
|
|
// eslint-disable-next-line global-require
|
|
|
|
implementation: require('sass'),
|
|
|
|
sassOptions: {
|
|
|
|
outputStyle: 'expanded',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
// Any `import`s from `node_modules` will compiled in to a `vendor.js` file.
|
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
cacheGroups: {
|
|
|
|
commons: {
|
|
|
|
test: /[\\/]node_modules[\\/]/,
|
|
|
|
name: 'vendor',
|
|
|
|
chunks: 'all',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
filename: '[name].css',
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
};
|