oyster/packages/lending/craco.config.js

58 lines
1.7 KiB
JavaScript
Raw Normal View History

const CracoLessPlugin = require('craco-less');
2021-02-08 12:48:07 -08:00
const CracoAlias = require('craco-alias');
const CracoBabelLoader = require('craco-babel-loader');
const path = require('path');
const fs = require('fs');
//console.log('qualified', pnp.resolveRequest('@babel/preset-typescript'), path.resolve(__dirname, '/') + 'src/');
// Handle relative paths to sibling packages
const appDirectory = fs.realpathSync(process.cwd());
2021-02-08 19:17:27 -08:00
const resolvePackage = relativePath => path.resolve(appDirectory, relativePath);
2020-11-16 20:59:53 -08:00
module.exports = {
2021-02-08 19:17:27 -08:00
/* webpack: {
configure: webpackConfig => {
2021-02-08 12:48:07 -08:00
const scopePluginIndex = webpackConfig.resolve.plugins.findIndex(
2021-02-08 19:17:27 -08:00
({ constructor }) =>
constructor && constructor.name === 'ModuleScopePlugin',
2021-02-08 12:48:07 -08:00
);
webpackConfig.resolve.plugins.splice(scopePluginIndex, 1);
return webpackConfig;
},
2021-02-08 19:17:27 -08:00
},*/
2020-11-16 20:59:53 -08:00
plugins: [
2021-02-08 19:17:27 -08:00
/*{
2021-02-08 12:48:07 -08:00
plugin: CracoBabelLoader,
options: {
includes: [
// No "unexpected token" error importing components from these lerna siblings:
resolvePackage('../packages'),
],
},
2021-02-08 19:17:27 -08:00
},*/
/*{
2021-02-08 12:48:07 -08:00
plugin: CracoAlias,
options: {
source: 'tsconfig',
// baseUrl SHOULD be specified
// plugin does not take it from tsconfig
2021-02-08 19:17:27 -08:00
baseUrl: '../../',
2021-02-08 12:48:07 -08:00
// tsConfigPath should point to the file where "baseUrl" and "paths" are specified
2021-02-08 19:17:27 -08:00
tsConfigPath: '../../tsconfig.json',
2021-02-08 12:48:07 -08:00
},
2021-02-08 19:17:27 -08:00
},*/
2020-11-16 20:59:53 -08:00
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: { '@primary-color': '#2abdd2' },
2020-11-16 20:59:53 -08:00
javascriptEnabled: true,
},
},
},
},
],
};