hendeca

Library of Kongress Webpack Config File

Apr 28th, 2021
729
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const path = require("path");
  2.  
  3. const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  4. // const devMode = process.env.NODE_ENV !== 'production';
  5.  
  6. module.exports = [{
  7.         entry: {
  8.             app: './src/sass/app.scss'
  9.         }, // string | object | array
  10.         // Here the application starts executing
  11.         // and webpack starts bundling
  12.  
  13.         output: {
  14.             // options related to how webpack emits results
  15.  
  16.             path: path.resolve(__dirname, "static"), // string
  17.             // the target directory for all output files
  18.             // must be an absolute path (use the Node.js path module)
  19.  
  20.             filename: "[name].js", // string
  21.             // the filename template for entry chunks
  22.         },
  23.  
  24.         module: {
  25.             rules: [{
  26.                     test: /\.(sa|sc|c)ss$/,
  27.                     use: [
  28.                         MiniCssExtractPlugin.loader,
  29.                         'css-loader',
  30.                         'postcss-loader',
  31.                         'sass-loader'
  32.                     ]
  33.                 },
  34.                 {
  35.                     test: /\.(png|jpg|jpeg|gif|eot|svg)$/,
  36.                     type: 'asset/inline'
  37.                 },
  38.                 {
  39.                     test: /\.(ttf|woff|woff2)$/,
  40.                     type: 'asset/inline'
  41.                 }
  42.             ]
  43.         },
  44.         plugins: [
  45.             new MiniCssExtractPlugin({
  46.                 filename: "./css/[name].css",
  47.                 chunkFilename: "[id].css"
  48.             })
  49.         ]
  50.     },
  51.     {
  52.         entry: {
  53.             js: './src/js/gallery.js'
  54.         },
  55.         output: {
  56.             path: path.resolve(__dirname, "static"),
  57.             filename: "./js/app.js"
  58.         }
  59.     }
  60. ]
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×