decred.org/dcrdex@v1.0.5/client/webserver/site/webpack/common.js (about) 1 const path = require('path') 2 const { CleanWebpackPlugin } = require('clean-webpack-plugin') 3 const MiniCssExtractPlugin = require('mini-css-extract-plugin') 4 const StyleLintPlugin = require('stylelint-webpack-plugin') 5 const ESLintPlugin = require('eslint-webpack-plugin') 6 7 const child_process = require('child_process') 8 function git(command) { 9 return child_process.execSync(`git ${command}`, { encoding: 'utf8' }).trim(); 10 } 11 12 module.exports = { 13 target: "web", 14 module: { 15 rules: [ 16 { 17 test: /\.s?[ac]ss$/, 18 use: [ 19 MiniCssExtractPlugin.loader, 20 { 21 loader: 'css-loader', 22 options: { 23 modules: false, 24 url: false, 25 sourceMap: true 26 } 27 }, 28 { 29 loader: 'sass-loader', 30 options: { 31 implementation: require("sass"), // dart-sass 32 sourceMap: true 33 } 34 } 35 ] 36 } 37 ] 38 }, 39 plugins: [ 40 new CleanWebpackPlugin(), 41 new MiniCssExtractPlugin({ 42 filename: '../dist/style.css' 43 }), 44 new StyleLintPlugin({ 45 threads: true, 46 }), 47 new ESLintPlugin({ 48 extensions: ['ts'], 49 formatter: 'stylish' 50 }) 51 ], 52 output: { 53 filename: 'entry.js', 54 path: path.resolve(__dirname, '../dist'), 55 publicPath: '/dist/' 56 }, 57 resolve: { 58 extensions: ['.ts', ".js"], 59 }, 60 // Fixes weird issue with watch script. See 61 // https://github.com/webpack/webpack/issues/2297#issuecomment-289291324 62 watchOptions: { 63 poll: true 64 } 65 }