Sha256: 6d59add1b28d17f38c8915315c96355d71488602c9e2ce47c72ce925eb36460c
Contents?: true
Size: 858 Bytes
Versions: 29
Compression:
Stored size: 858 Bytes
Contents
/* eslint global-require: 0 */ /* eslint import/no-dynamic-require: 0 */ const { resolve } = require('path') const { existsSync } = require('fs') const { merge } = require('webpack-merge') const getLoaderExtension = (filename) => { const matchData = filename.match(/\.([jt]sx?)?(\.erb)?$/) if (!matchData) { return 'js' } return matchData[1] } const getCustomConfig = () => { const path = resolve('config', 'esbuild.config.js') if (existsSync(path)) { return require(path) } return {} } const getEsbuildLoaderConfig = (filenameToProcess) => { const customConfig = getCustomConfig() const defaultConfig = { loader: require.resolve('esbuild-loader'), options: { loader: getLoaderExtension(filenameToProcess) } } return merge(defaultConfig, customConfig) } module.exports = { getEsbuildLoaderConfig }
Version data entries
29 entries across 29 versions & 1 rubygems