0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00
logto/packages/ui/razzle.config.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-07-29 14:42:39 -05:00
'use strict';
2021-07-11 08:08:38 -05:00
2021-07-29 14:42:39 -05:00
const path = require('path');
2021-07-11 08:08:38 -05:00
module.exports = {
options: {
2021-07-29 14:42:39 -05:00
buildType: 'spa',
2021-07-11 08:08:38 -05:00
},
2021-07-29 14:42:39 -05:00
plugins: ['scss'],
2021-07-11 08:08:38 -05:00
modifyWebpackConfig: ({ webpackConfig }) => {
/** @type {import('webpack').Configuration} **/
2021-07-11 08:08:38 -05:00
const config = { ...webpackConfig };
config.resolve.alias = {
2021-07-29 14:42:39 -05:00
'@': path.resolve('src/'),
};
config.module.rules.push({
test: require.resolve('ky'),
use: {
loader: 'imports-loader',
options: {
imports: 'side-effects @ungap/global-this',
},
},
});
2021-07-29 14:42:39 -05:00
return config;
},
modifyJestConfig: ({ jestConfig }) => {
/** @type {import('@jest/types').Config.InitialOptions} **/
const config = { ...jestConfig };
config.transformIgnorePatterns = [
'^.+\\.module\\.(css|sass|scss)$',
'[/\\\\]node_modules[/\\\\]((?!ky[/\\\\]).)+\\.(js|jsx|mjs|cjs|ts|tsx)$',
];
2021-07-29 14:42:39 -05:00
config.moduleNameMapper = {
...config.moduleNameMapper,
'^.+\\.(css|less|scss)$': 'babel-jest',
'@/(.*)': '<rootDir>/src/$1',
2021-07-11 08:08:38 -05:00
};
2021-08-02 10:45:55 -05:00
config.setupFilesAfterEnv = [...config.setupFilesAfterEnv, './src/jest.setup.ts'];
2021-07-11 08:08:38 -05:00
return config;
},
};