Skip to content

Commit

Permalink
fix babel-loader using resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
smouillour committed Oct 13, 2023
1 parent 9bc0d00 commit 42a0939
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/icons/webpack.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = (env = {}) => ({
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
loader: require.resolve('babel-loader'),
},
},
{
Expand Down
15 changes: 7 additions & 8 deletions tools/scripts-build-cdn/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ async function main(args) {
const patchPath = `${__dirname}/patch/${packageName}/${version}`;
const UMDFileName = packageCdnConfig.path.replace(`/${TARGET}/`, '');

if (
fs.existsSync(`${packagePath}/${version}/${TARGET}/${UMDFileName}`) &&
!program.force
) {
if (fs.existsSync(`${packagePath}/${version}/${TARGET}/${UMDFileName}`) && !program.force) {
await cleanup(packagePath, version);
continue;
}
Expand All @@ -73,7 +70,7 @@ async function main(args) {
}

const devDependencies = {
'd3': '^6.5.0' // so we can support d3-x babel plugin
d3: '^6.5.0', // so we can support d3-x babel plugin
};

if (packageName.includes('react') || packageName.includes('rc-')) {
Expand Down Expand Up @@ -129,7 +126,7 @@ module.exports = {
{
test: /\.js$/,
use: {
loader: 'babel-loader',
loader: require.resolve('babel-loader'),
options: {
plugins: ['@talend/babel-plugin-import-d3']
}
Expand All @@ -156,7 +153,7 @@ module.exports = {
`${packagePath}/${version}/webpack.index.js`,
`export { default } from '${packageName}';
export * from '${packageName}';
`
`,
);
}

Expand All @@ -167,7 +164,9 @@ module.exports = {
console.error(error);
return;
}
const info = require(`${process.cwd()}/${packagePath}/${version}/node_modules/${packageName}/package.json`);
const info = require(
`${process.cwd()}/${packagePath}/${version}/node_modules/${packageName}/package.json`,
);
if (info.peerDependencies) {
pjson.devDependencies = Object.keys(info.peerDependencies).reduce((acc, key) => {
acc[key] = info.peerDependencies[key];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function getCommonStyleLoaders(enableModules, isEnvDevelopmentServe) {
function getJSAndTSLoader() {
return [
{
loader: 'babel-loader',
loader: require.resolve('babel-loader'),
options: getBabelLoaderOptions(babelConfig),
},
].filter(Boolean);
Expand Down

0 comments on commit 42a0939

Please sign in to comment.