bigbuffet-rw/webpack/rules/node-modules.ts

29 lines
623 B
TypeScript
Raw Normal View History

2022-10-14 13:43:32 -07:00
import { join } from 'path';
2022-10-14 13:43:32 -07:00
import { env, settings } from '../configuration';
2020-03-27 13:59:38 -07:00
2022-10-14 13:43:32 -07:00
import type { RuleSetRule } from 'webpack';
const rule: RuleSetRule = {
2020-03-27 13:59:38 -07:00
test: /\.(js|mjs)$/,
include: /node_modules/,
exclude: [
/@babel(?:\/|\\{1,2})runtime/,
/\bcore-js\b/,
/\bwebpack\/buildin\b/,
],
2020-03-27 13:59:38 -07:00
use: [
{
loader: 'babel-loader',
options: {
babelrc: false,
cacheDirectory: join(settings.cache_path, 'babel-loader-node-modules'),
cacheCompression: env.NODE_ENV === 'production',
compact: false,
sourceMaps: false,
},
},
],
};
2022-10-14 13:43:32 -07:00
export default rule;