vite-plugin-legacy icon indicating copy to clipboard operation
vite-plugin-legacy copied to clipboard

[vite:legacy] unknown: Property name expected type of string but got undefined

Open aminya opened this issue 3 years ago • 0 comments

I am trying to use this plugin with Astro, but I get this error:

08:00:16 PM [build] output target: static
08:00:16 PM [build] Collecting build info...
08:00:16 PM [build] Completed in 36ms.
08:00:16 PM [build] Building static entrypoints...
[vite:legacy] unknown: Property name expected type of string but got undefined
 error   unknown: Property name expected type of string but got undefined
TypeError: unknown: Property name expected type of string but got undefined
    at validate (C:\my_proj\node_modules\.pnpm\@[email protected]\node_modules\@babel\types\lib\definitions\utils.js:159:13)
    at Object.validate (C:\my_proj\node_modules\.pnpm\@[email protected]\node_modules\@babel\types\lib\definitions\utils.js:228:7)
    at validateField (C:\my_proj\node_modules\.pnpm\@[email protected]\node_modules\@babel\types\lib\validators\validate.js:24:9)
    at validate (C:\my_proj\node_modules\.pnpm\@[email protected]\node_modules\@babel\types\lib\validators\validate.js:17:3)
    at validateNode (C:\my_proj\node_modules\.pnpm\@[email protected]\node_modules\@babel\types\lib\builders\validateNode.js:16:27)
    at Object.identifier (C:\my_proj\node_modules\.pnpm\@[email protected]\node_modules\@babel\types\lib\builders\generated\index.js:432:36)
    at C:\my_proj\node_modules\.pnpm\[email protected]\node_modules\regenerator-transform\lib\hoist.js:34:29       
    at Array.forEach (<anonymous>)
    at varDeclToExpr (C:\my_proj\node_modules\.pnpm\[email protected]\node_modules\regenerator-transform\lib\hoist.js:31:23)
    at exit (C:\my_proj\node_modules\.pnpm\[email protected]\node_modules\regenerator-transform\lib\hoist.js:53:20)

The config file:

import { defineConfig } from "astro/config"
import { astroImageTools } from "astro-imagetools"
import solidJs from "@astrojs/solid-js"

import vitePluginLegacy from "vite-plugin-legacy"
const legacyPlugin = vitePluginLegacy.default

// https://astro.build/config
export default defineConfig({
  integrations: [astroImageTools, solidJs()],
  site: "https://aminya.github.io",
  base: "/",
  trailingSlash: "always",
  // done by Parcel
  vite: {
    plugins: [
      // The default options are listed below. Pass nothing to use them.
      legacyPlugin({
        // The browsers that must be supported by your legacy bundle.
        // https://babeljs.io/docs/en/babel-preset-env#targets
        targets: ["> 0.5%", "last 2 versions", "Firefox ESR", "not dead"],
        // Toggles whether or not browserslist config sources are used.
        // https://babeljs.io/docs/en/babel-preset-env#ignorebrowserslistconfig
        ignoreBrowserslistConfig: false,
        // When true, core-js@3 modules are inlined based on usage.
        // When false, global namespace APIs (eg: Object.entries) are loaded
        // from the Polyfill.io server.
        corejs: false,
      }),
    ],
  },
  outDir: "./astro-dist",
})

aminya avatar Sep 04 '22 03:09 aminya