* Migrate to esbuild WIP * Add exclude * Remove redundant file * Move file * Move to javascript_include_tag * Lint fix * WIP * WIP * Add watch mode to esbuild WIP * Get jest working * Remove babel * Revert "Remove babel" This reverts commit 6da35260aa19d6f97f586deb66c0ecaf48433b73. * More WIP * Got image to load * WIP * Resolve audit * Lint fix * WIP * Fix jest spec * [CI] Remove asset-restore for test build stage * Production compliant * Temp disable sourcemap * Update glob * Add esbuild helper to stimulus * Import fragment * Temp disable coverage to see failing tests * Fix broken spec * Address lint * Set proper es6 target * Use esbuild for everything * wait what * Revert "Set proper es6 target" This reverts commit 98f5278093421baa8ffe2ca580845b01c1a1eadf. * Revert "Use esbuild for everything" This reverts commit 0ac46738f07ffcb6af095ccb1ffa5e439b7fefa3. * Replace uglifier with terser * New compiled assets version * Remvoe honeybadger-io/webpack * Remove cypress coverage checks for now * Update jsconfig.json * Update docker-compose * Remove public/packs-test from ci cache
102 lines
2.5 KiB
JavaScript
102 lines
2.5 KiB
JavaScript
/* eslint-env node */
|
|
|
|
module.exports = function (api) {
|
|
var validEnv = ['development', 'test', 'production'];
|
|
var currentEnv = api.env();
|
|
var isDevelopmentEnv = api.env('development');
|
|
var isProductionEnv = api.env('production');
|
|
var isTestEnv = api.env('test');
|
|
var isEndToEnd = process.env.E2E === 'true';
|
|
|
|
if (!validEnv.includes(currentEnv)) {
|
|
throw new Error(
|
|
'Please specify a valid `NODE_ENV` or ' +
|
|
'`BABEL_ENV` environment variables. Valid values are "development", ' +
|
|
'"test", and "production". Instead, received: ' +
|
|
JSON.stringify(currentEnv) +
|
|
'.',
|
|
);
|
|
}
|
|
|
|
return {
|
|
presets: [
|
|
(isProductionEnv || isDevelopmentEnv || isTestEnv) && [
|
|
'@babel/preset-env',
|
|
{
|
|
modules: false,
|
|
targets: { browsers: '> 1%' },
|
|
useBuiltIns: 'entry',
|
|
corejs: { version: 3, proposals: false },
|
|
exclude: ['transform-regenerator'],
|
|
bugfixes: true,
|
|
forceAllTransforms: true,
|
|
},
|
|
'preact',
|
|
],
|
|
].filter(Boolean),
|
|
plugins: [
|
|
isEndToEnd && ['istanbul'],
|
|
'@babel/plugin-syntax-dynamic-import',
|
|
isTestEnv && '@babel/plugin-transform-modules-commonjs',
|
|
'@babel/plugin-transform-destructuring',
|
|
[
|
|
'@babel/plugin-proposal-class-properties',
|
|
{
|
|
spec: true,
|
|
loose: true,
|
|
},
|
|
],
|
|
[
|
|
'@babel/plugin-proposal-object-rest-spread',
|
|
{
|
|
useBuiltIns: true,
|
|
},
|
|
],
|
|
[
|
|
'@babel/plugin-transform-private-property-in-object',
|
|
{
|
|
loose: true,
|
|
},
|
|
],
|
|
[
|
|
'@babel/plugin-transform-private-methods',
|
|
{
|
|
loose: true,
|
|
},
|
|
],
|
|
[
|
|
'@babel/plugin-transform-react-jsx',
|
|
{
|
|
pragma: 'h',
|
|
},
|
|
],
|
|
[
|
|
'inline-react-svg',
|
|
{
|
|
svgo: {
|
|
plugins: [
|
|
{
|
|
name: 'preset-default',
|
|
params: {
|
|
overrides: {
|
|
removeViewBox: false,
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
[
|
|
'module-resolver',
|
|
{
|
|
// Only the @images webpack alias is here because it's being used by a
|
|
// Babel plugin before webpack runs in the frontend build pipeline.
|
|
alias: {
|
|
'@images': './app/assets/images/',
|
|
},
|
|
},
|
|
],
|
|
].filter(Boolean),
|
|
};
|
|
};
|