alloc/vite-plugin-legacy

Error: .inputSourceMap must be a boolean, object, or undefined

Closed this issue · 3 comments

Thx, published under v0.1.4

0x30 commented

Hello,

maybe we should use configuration files such as browserlistrc and babel.config.js as much as possible, and don't re-define these configurations by passing them.

In addition, I don’t know much about polyfill.io... But I can’t accept it. Import a file into my project through external links... At least it should be within my control...

I would prefer if you opened a new issue for each concern.

maybe we should use configuration files such as browserlistrc and babel.config.js as much as possible, and don't re-define these configurations by passing them.

We already use browserslist config by default, since that's how @babel/preset-env works. If it's not working, let me know.

If you want babel.config.js to be applied, you can add @rollup/plugin-babel to the rollupInputOptions.plugins array in your Vite config. Then your Babel config will be applied to both modern and legacy bundles.

import { getBabelOutputPlugin } from "@rollup/plugin-babel";
import path from "path";

export default {
  rollupInputOptions: {
    plugins: [
      getBabelOutputPlugin({
        configFile: path.resolve(__dirname, "babel.config.js"),
      }),
    ],
  },
};

In addition, I don’t know much about polyfill.io... But I can’t accept it. Import a file into my project through external links... At least it should be within my control...

You can set corejs: true to disable Polyfill.io imports.

Note: The polyfills option will always add a Polyfill.io import.