Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(babel-preset): cjs extension should be js #5952

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/few-fireants-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modern-js/babel-preset': patch
---

fix(babel-preset): cjs extension should be js
2 changes: 1 addition & 1 deletion packages/cli/babel-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": {
"type": "git",
"url": "https://github.com/web-infra-dev/modern.js",
"directory": "packages/builder/uni-builder"
"directory": "packages/cli/babel-preset"
},
"license": "MIT",
"type": "commonjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/babel-preset/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const getBabelConfigForWeb = (
]);
}

config.plugins?.push(join(__dirname, './pluginLockCorejsVersion.cjs'));
config.plugins?.push(join(__dirname, './pluginLockCorejsVersion.js'));

return config;
};
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/babel-preset/tests/__snapshots__/web.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exports[`should allow to enable legacy decorator 1`] = `
"version": "7.24.7",
},
],
"<ROOT>/src/pluginLockCorejsVersion.cjs",
"<ROOT>/src/pluginLockCorejsVersion.js",
],
"presets": [
[
Expand Down Expand Up @@ -84,7 +84,7 @@ exports[`should allow to enable specific version decorator 1`] = `
"version": "7.24.7",
},
],
"<ROOT>/src/pluginLockCorejsVersion.cjs",
"<ROOT>/src/pluginLockCorejsVersion.js",
],
"presets": [
[
Expand Down Expand Up @@ -134,7 +134,7 @@ exports[`should provide web preset as expected 1`] = `
"version": "7.24.7",
},
],
"<ROOT>/src/pluginLockCorejsVersion.cjs",
"<ROOT>/src/pluginLockCorejsVersion.js",
],
"presets": [
[
Expand Down Expand Up @@ -225,7 +225,7 @@ exports[`should support inject core-js polyfills by entry 1`] = `
"version": "7.24.7",
},
],
"<ROOT>/src/pluginLockCorejsVersion.cjs",
"<ROOT>/src/pluginLockCorejsVersion.js",
],
"presets": [
[
Expand Down Expand Up @@ -278,7 +278,7 @@ exports[`should support inject core-js polyfills by usage 1`] = `
"version": "7.24.7",
},
],
"<ROOT>/src/pluginLockCorejsVersion.cjs",
"<ROOT>/src/pluginLockCorejsVersion.js",
],
"presets": [
[
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/uni-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": {
"type": "git",
"url": "https://github.com/web-infra-dev/modern.js",
"directory": "packages/builder/uni-builder"
"directory": "packages/cli/uni-builder"
},
"license": "MIT",
"type": "commonjs",
Expand Down
24 changes: 12 additions & 12 deletions packages/cli/uni-builder/tests/__snapshots__/babel.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ exports[`plugin-babel > should add core-js-entry when output.polyfill is entry 1
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -531,7 +531,7 @@ exports[`plugin-babel > should apply exclude condition when using source.exclude
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -673,7 +673,7 @@ exports[`plugin-babel > should not add core-js-entry when output.polyfill is usa
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -809,7 +809,7 @@ exports[`plugin-babel > should not have any pluginImport in Babel 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<ROOT>/compiled/babel-plugin-lodash/index.js",
{},
Expand Down Expand Up @@ -917,7 +917,7 @@ exports[`plugin-babel > should not have any pluginImport in Babel 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<ROOT>/compiled/babel-plugin-lodash/index.js",
{},
Expand Down Expand Up @@ -1028,7 +1028,7 @@ exports[`plugin-babel > should not set default pluginImport for Babel 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -1155,7 +1155,7 @@ exports[`plugin-babel > should not set default pluginImport for Babel 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -1290,7 +1290,7 @@ exports[`plugin-babel > should override targets of babel-preset-env when using o
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -1430,7 +1430,7 @@ exports[`plugin-babel > should set babel-loader 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -1576,7 +1576,7 @@ exports[`plugin-babel > should set include/exclude 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -1712,7 +1712,7 @@ exports[`plugin-babel > should set proper pluginImport option in Babel 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -1847,7 +1847,7 @@ exports[`plugin-babel > should set proper pluginImport option in Babel 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3515,7 +3515,7 @@ exports[`uni-builder webpack > should generator webpack config correctly 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -3642,7 +3642,7 @@ exports[`uni-builder webpack > should generator webpack config correctly 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -4030,7 +4030,7 @@ exports[`uni-builder webpack > should generator webpack config correctly 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -4158,7 +4158,7 @@ exports[`uni-builder webpack > should generator webpack config correctly 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -4631,7 +4631,7 @@ exports[`uni-builder webpack > should generator webpack config correctly when pr
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -4758,7 +4758,7 @@ exports[`uni-builder webpack > should generator webpack config correctly when pr
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -5152,7 +5152,7 @@ exports[`uni-builder webpack > should generator webpack config correctly when pr
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -5295,7 +5295,7 @@ exports[`uni-builder webpack > should generator webpack config correctly when pr
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ exports[`plugins/react > should work with babel-loader 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ exports[`plugins/styled-components > should enable ssr when target contain node
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down Expand Up @@ -313,7 +313,7 @@ exports[`plugins/styled-components > should works in webpack babel mode 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/babel-plugin-import/lib/index.js",
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ exports[`plugin-ts-loader > should set include/exclude 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/react-refresh/babel.js",
{
Expand Down Expand Up @@ -337,7 +337,7 @@ exports[`plugin-ts-loader > should set ts-loader 1`] = `
"version": "7.24.7",
},
],
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.cjs",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
[
"<WORKSPACE>/node_modules/<PNPM_INNER>/react-refresh/babel.js",
{
Expand Down
25 changes: 3 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading