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

@vue/babel-preset-app@4.5.19 causes incorrect dynamic import result. #7214

Open
wangchuan95 opened this issue Jun 25, 2022 · 1 comment
Open

Comments

@wangchuan95
Copy link

wangchuan95 commented Jun 25, 2022

Here is a entry file:

// main.js

function dynamicImport(filename) {
  import('./modules/' + `${filename}.json`);
}

Here is my babel config file:

// babel.config.js

module.exports = {
  presets: ['@vue/babel-preset-app'],
};

If I install @vue/babel-preset-app@4.5.19 and run yarn build, it output:

./src/modules/ lazy ^\.\/.*$

As you could see, it includes all files under ./src/modules/.

But if I install @vue/babel-preset-app@4.5.18 and run yarn build, it output:

./src/modules/ lazy ^\.\/.*\.json$

It just includes all .json files and is more specific.

Here are my other files:

package.json:

{
  "private": true,
  "scripts": {
    "build": "webpack"
  },
  "devDependencies": {
    "@babel/core": "^7.22.5",
    "@vue/babel-preset-app": "4.5.18",
    "babel-loader": "^9.1.2",
    "webpack": "^5.87.0",
    "webpack-cli": "^5.1.4"
  }
}
// webpack.config.js

const { resolve } = require('path');

module.exports = {
  mode: 'development',
  entry: './src/main.js',
  output: {
    clean: true,
    path: resolve(__dirname, './dist'),
  },
  module: {
    rules: [
      {
        test: /\.m?jsx?$/,
        use: [
          {
            loader: 'babel-loader',
          },
        ],
      },
    ],
  },
};
@wangchuan95 wangchuan95 changed the title @vue/cli-plugin-babel@4.5.17 dynamic import result is not same @vue/babel-preset-app@4.5.19 dynamic import result is not specific. Jun 19, 2023
@wangchuan95 wangchuan95 changed the title @vue/babel-preset-app@4.5.19 dynamic import result is not specific. @vue/babel-preset-app@4.5.19 causes incorrect dynamic import result. Jun 19, 2023
@wangchuan95
Copy link
Author

@sodatea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant