github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/scripts/webpack/shared.ts (about) 1 import MiniCssExtractPlugin from 'mini-css-extract-plugin'; 2 import path from 'path'; 3 4 // TODO: 5 export function getStyleLoaders() { 6 return [ 7 { 8 test: /\.(css|scss)$/, 9 use: [ 10 MiniCssExtractPlugin.loader, 11 { 12 loader: 'css-loader', 13 options: { 14 importLoaders: 2, 15 url: true, 16 }, 17 }, 18 { 19 loader: 'postcss-loader', 20 options: { 21 config: { path: __dirname }, 22 }, 23 }, 24 { 25 loader: 'sass-loader', 26 options: { 27 // sourceMap: true, 28 }, 29 }, 30 ], 31 }, 32 ]; 33 } 34 35 export function getAlias() { 36 return { 37 // rc-trigger uses babel-runtime which has internal dependency to core-js@2 38 // this alias maps that dependency to core-js@t3 39 'core-js/library/fn': 'core-js/stable', 40 '@webapp': path.resolve(__dirname, '../../webapp/javascript'), 41 }; 42 } 43 44 export function getJsLoader() { 45 return [ 46 { 47 test: /\.(js|ts)x?$/, 48 exclude: /node_modules/, 49 use: [ 50 { 51 loader: 'esbuild-loader', 52 options: { 53 loader: 'tsx', // Or 'ts' if you don't need tsx 54 target: 'es2015', 55 }, 56 }, 57 ], 58 }, 59 ]; 60 }