mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 02:12:56 +00:00
chore: add babel.config to fix build error
This commit is contained in:
parent
f9e6913c20
commit
bc5ec03884
6
babel.config.js
Normal file
6
babel.config.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
['@babel/plugin-proposal-decorators', { legacy: true }],
|
||||||
|
[require.resolve('@babel/plugin-proposal-class-properties'), { loose: true }],
|
||||||
|
],
|
||||||
|
};
|
||||||
1
modules/code-generator/babel.config.js
Normal file
1
modules/code-generator/babel.config.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('../../babel.config');
|
||||||
@ -1,22 +0,0 @@
|
|||||||
const babelJest = require('babel-jest');
|
|
||||||
const getBabelConfig = require('build-scripts-config/lib/config/babel/index.js');
|
|
||||||
const formatWinPath = require('build-scripts-config/lib/config/jest/formatWinPath');
|
|
||||||
const babelConfig = getBabelConfig();
|
|
||||||
|
|
||||||
babelConfig.plugins.push(['@babel/plugin-proposal-class-properties', { loose: true }]);
|
|
||||||
|
|
||||||
const jestBabelConfig = {
|
|
||||||
...babelConfig,
|
|
||||||
presets: babelConfig.presets.map((preset) => {
|
|
||||||
if (Array.isArray(preset) && formatWinPath(preset[0]).indexOf('@babel/preset-env') > -1) {
|
|
||||||
return [preset[0], {
|
|
||||||
targets: {
|
|
||||||
node: 'current',
|
|
||||||
},
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
return preset;
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = babelJest.createTransformer(jestBabelConfig);
|
|
||||||
@ -1,8 +1,4 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
transform: {
|
|
||||||
'^.+\\.(js|jsx|ts|tsx)$': './babelTransform.js',
|
|
||||||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': 'build-scripts-config/lib/config/jest/fileTransform.js',
|
|
||||||
},
|
|
||||||
preset: 'ts-jest',
|
preset: 'ts-jest',
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
transformIgnorePatterns: ['/node_modules/(?!core-js)/'],
|
transformIgnorePatterns: ['/node_modules/(?!core-js)/'],
|
||||||
|
|||||||
1
packages/designer/babel.config.js
Normal file
1
packages/designer/babel.config.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('../../babel.config');
|
||||||
@ -1,22 +0,0 @@
|
|||||||
const babelJest = require('babel-jest');
|
|
||||||
const getBabelConfig = require('build-scripts-config/lib/config/babel/index.js');
|
|
||||||
const formatWinPath = require('build-scripts-config/lib/config/jest/formatWinPath');
|
|
||||||
const babelConfig = getBabelConfig();
|
|
||||||
|
|
||||||
babelConfig.plugins.push(['@babel/plugin-proposal-class-properties', { loose: true }]);
|
|
||||||
|
|
||||||
const jestBabelConfig = {
|
|
||||||
...babelConfig,
|
|
||||||
presets: babelConfig.presets.map((preset) => {
|
|
||||||
if (Array.isArray(preset) && formatWinPath(preset[0]).indexOf('@babel/preset-env') > -1) {
|
|
||||||
return [preset[0], {
|
|
||||||
targets: {
|
|
||||||
node: 'current',
|
|
||||||
},
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
return preset;
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = babelJest.createTransformer(jestBabelConfig);
|
|
||||||
@ -4,10 +4,6 @@ const esModules = [].join('|');
|
|||||||
const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.'));
|
const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.'));
|
||||||
|
|
||||||
const jestConfig = {
|
const jestConfig = {
|
||||||
transform: {
|
|
||||||
'^.+\\.(js|jsx|ts|tsx)$': './babelTransform.js',
|
|
||||||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': 'build-scripts-config/lib/config/jest/fileTransform.js',
|
|
||||||
},
|
|
||||||
// transform: {
|
// transform: {
|
||||||
// '^.+\\.[jt]sx?$': 'babel-jest',
|
// '^.+\\.[jt]sx?$': 'babel-jest',
|
||||||
// // '^.+\\.(ts|tsx)$': 'ts-jest',
|
// // '^.+\\.(ts|tsx)$': 'ts-jest',
|
||||||
|
|||||||
1
packages/engine/babel.config.js
Normal file
1
packages/engine/babel.config.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('../../babel.config');
|
||||||
@ -25,24 +25,6 @@ const releaseVersion = getVersion();
|
|||||||
|
|
||||||
module.exports = ({ context, onGetWebpackConfig }) => {
|
module.exports = ({ context, onGetWebpackConfig }) => {
|
||||||
onGetWebpackConfig((config) => {
|
onGetWebpackConfig((config) => {
|
||||||
['jsx', 'tsx'].forEach((rule) => {
|
|
||||||
config.module
|
|
||||||
.rule(rule)
|
|
||||||
.exclude.clear()
|
|
||||||
.add(/node_modules(?!(.+_component_demo|.+build-plugin-component))/)
|
|
||||||
.end()
|
|
||||||
.use('babel-loader')
|
|
||||||
.tap((options) => {
|
|
||||||
const { plugins = [] } = options;
|
|
||||||
return {
|
|
||||||
...options,
|
|
||||||
plugins: [
|
|
||||||
...plugins,
|
|
||||||
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
||||||
],
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
config.resolve
|
config.resolve
|
||||||
.plugin('tsconfigpaths')
|
.plugin('tsconfigpaths')
|
||||||
.use(TsconfigPathsPlugin, [{
|
.use(TsconfigPathsPlugin, [{
|
||||||
|
|||||||
1
packages/ignitor/babel.config.js
Normal file
1
packages/ignitor/babel.config.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('../../babel.config');
|
||||||
@ -6,26 +6,6 @@ const { version } = lernaConfig;
|
|||||||
|
|
||||||
module.exports = ({ context, onGetWebpackConfig }) => {
|
module.exports = ({ context, onGetWebpackConfig }) => {
|
||||||
onGetWebpackConfig((config) => {
|
onGetWebpackConfig((config) => {
|
||||||
['jsx', 'tsx'].forEach((rule) => {
|
|
||||||
config.module
|
|
||||||
.rule(rule)
|
|
||||||
.exclude.clear()
|
|
||||||
.add(/node_modules(?!(.+_component_demo|.+build-plugin-component))/)
|
|
||||||
.end()
|
|
||||||
.use('babel-loader')
|
|
||||||
.tap((options) => {
|
|
||||||
const { plugins = [] } = options;
|
|
||||||
console.log('plugins', plugins);
|
|
||||||
return {
|
|
||||||
...options,
|
|
||||||
plugins: [
|
|
||||||
...plugins,
|
|
||||||
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
||||||
],
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
config.resolve.plugin('tsconfigpaths').use(TsconfigPathsPlugin, [
|
config.resolve.plugin('tsconfigpaths').use(TsconfigPathsPlugin, [
|
||||||
{
|
{
|
||||||
configFile: './tsconfig.json',
|
configFile: './tsconfig.json',
|
||||||
|
|||||||
47
packages/ignitor/jest.config.js
Normal file
47
packages/ignitor/jest.config.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const { join } = require('path');
|
||||||
|
const esModules = [].join('|');
|
||||||
|
const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.'));
|
||||||
|
|
||||||
|
const jestConfig = {
|
||||||
|
// transform: {
|
||||||
|
// '^.+\\.[jt]sx?$': 'babel-jest',
|
||||||
|
// // '^.+\\.(ts|tsx)$': 'ts-jest',
|
||||||
|
// // '^.+\\.(js|jsx)$': 'babel-jest',
|
||||||
|
// },
|
||||||
|
// testMatch: ['**/node-children.test.ts'],
|
||||||
|
// testMatch: ['**/plugin-manager.test.ts'],
|
||||||
|
// testMatch: ['**/history/history.test.ts'],
|
||||||
|
// testMatch: ['**/document-model.test.ts'],
|
||||||
|
// testMatch: ['**/prop.test.ts'],
|
||||||
|
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
|
||||||
|
transformIgnorePatterns: [
|
||||||
|
`/node_modules/(?!${esModules})/`,
|
||||||
|
],
|
||||||
|
setupFiles: ['./tests/fixtures/unhandled-rejection.ts'],
|
||||||
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
||||||
|
collectCoverage: false,
|
||||||
|
collectCoverageFrom: [
|
||||||
|
'src/**/*.ts',
|
||||||
|
'!src/**/*.d.ts',
|
||||||
|
'!src/icons/**',
|
||||||
|
'!src/locale/**',
|
||||||
|
'!src/builtin-simulator/utils/**',
|
||||||
|
'!src/plugin/sequencify.ts',
|
||||||
|
'!src/document/node/exclusive-group.ts',
|
||||||
|
'!src/document/node/props/value-to-source.ts',
|
||||||
|
'!src/builtin-simulator/live-editing/live-editing.ts',
|
||||||
|
'!src/designer/offset-observer.ts',
|
||||||
|
'!src/designer/clipboard.ts',
|
||||||
|
'!src/designer/scroller.ts',
|
||||||
|
'!src/builtin-simulator/host.ts',
|
||||||
|
'!**/node_modules/**',
|
||||||
|
'!**/vendor/**',
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
// 只对本仓库内的 pkg 做 mapping
|
||||||
|
jestConfig.moduleNameMapper = {};
|
||||||
|
jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src';
|
||||||
|
|
||||||
|
module.exports = jestConfig;
|
||||||
1
packages/rax-simulator-renderer/babel.config.js
Normal file
1
packages/rax-simulator-renderer/babel.config.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('../../babel.config');
|
||||||
@ -1,24 +1,5 @@
|
|||||||
module.exports = ({ onGetWebpackConfig }) => {
|
module.exports = ({ onGetWebpackConfig }) => {
|
||||||
onGetWebpackConfig((config) => {
|
onGetWebpackConfig((config) => {
|
||||||
['jsx', 'tsx'].forEach((rule) => {
|
|
||||||
config.module
|
|
||||||
.rule(rule)
|
|
||||||
.exclude.clear()
|
|
||||||
.add(/node_modules(?!(.+_component_demo|.+build-plugin-component))/)
|
|
||||||
.end()
|
|
||||||
.use('babel-loader')
|
|
||||||
.tap((options) => {
|
|
||||||
const { plugins = [] } = options;
|
|
||||||
console.log('plugins', plugins);
|
|
||||||
return {
|
|
||||||
...options,
|
|
||||||
plugins: [
|
|
||||||
...plugins,
|
|
||||||
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
||||||
],
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
config.performance.hints(false);
|
config.performance.hints(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
1
packages/react-simulator-renderer/babel.config.js
Normal file
1
packages/react-simulator-renderer/babel.config.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('../../babel.config');
|
||||||
@ -1,24 +1,5 @@
|
|||||||
module.exports = ({ onGetWebpackConfig }) => {
|
module.exports = ({ onGetWebpackConfig }) => {
|
||||||
onGetWebpackConfig((config) => {
|
onGetWebpackConfig((config) => {
|
||||||
['jsx', 'tsx'].forEach((rule) => {
|
|
||||||
config.module
|
|
||||||
.rule(rule)
|
|
||||||
.exclude.clear()
|
|
||||||
.add(/node_modules(?!(.+_component_demo|.+build-plugin-component))/)
|
|
||||||
.end()
|
|
||||||
.use('babel-loader')
|
|
||||||
.tap((options) => {
|
|
||||||
const { plugins = [] } = options;
|
|
||||||
console.log('plugins', plugins);
|
|
||||||
return {
|
|
||||||
...options,
|
|
||||||
plugins: [
|
|
||||||
...plugins,
|
|
||||||
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
||||||
],
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
config.performance.hints(false);
|
config.performance.hints(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user