soapbox/webpack/rules/node-modules.ts

32 wiersze
700 B
TypeScript
Czysty Zwykły widok Historia

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