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

Vite 3 fails on build of module #799

Open
Halling69 opened this issue Jul 4, 2024 · 1 comment
Open

Vite 3 fails on build of module #799

Halling69 opened this issue Jul 4, 2024 · 1 comment

Comments

@Halling69
Copy link

When compiling an old vue 2 project using https://github.com/vuejs/create-vue @legacy
I get the following error with [email protected]

[vite:vue2] Could not load /node_modules/vue2-google-maps/dist/components/placeInputImpl.js?vue&type=script&src=true&lang.js?commonjs-exports (imported by node_modules/vue2-google-maps/dist/components/placeInputImpl.js?vue&type=script&src=true&lang.js): The argument 'path' must be a string, Uint8Array, or URL without null bytes. Received '\x00/node_modules/vue2-google-maps/dist/components/pl...
error during build:
TypeError [PLUGIN_ERROR]: Could not load /node_modules/vue2-google-maps/dist/components/placeInputImpl.js?vue&type=script&src=true&lang.js?commonjs-exports (imported by node_modules/vue2-google-maps/dist/components/placeInputImpl.js?vue&type=script&src=true&lang.js): The argument 'path' must be a string, Uint8Array, or URL without null bytes. Received '\x00/node_modules/vue2-google-maps/dist/components/pl...
at Object.readFileSync (node:fs:440:14)
at Object.load (C:\projects\sanistaal\Webshop-v4\src\Sanistaal.Website\client-vite\Ahlsell\node_modules@vitejs\plugin-vue2\dist\index.cjs:3217:30)
at file:////node_modules/rollup/dist/es/shared/rollup.js:22748:40
ERROR: "build-only" exited with 1.

I have identified the root cause being in placeInput.vue

<template>
    <label>
        <span v-text="label"></span>
        <input type="text" :placeholder="placeholder" :class="className"
          ref="input"/>
    </label>
</template>

<script src="./placeInputImpl.js">
</script>

The other vue components use function based require inclusion of the corresponding backend code so this code works:

<template>
    <label>
        <span v-text="label"></span>
        <input type="text" :placeholder="placeholder" :class="className"
          ref="input"/>
    </label>
</template>

<script>
export default (function (x) { return x.default || x })(require('./placeInputImpl.js'))
</script>
Halling69 added a commit to Halling69/vue-google-maps that referenced this issue Jul 4, 2024
@aroy314
Copy link

aroy314 commented Aug 23, 2024

Please let us know when this is fixed so we can close vitejs/vite-plugin-vue2#63

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

2 participants