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

clean build fails on latest version of Vite #3

Open
dlqqq opened this issue May 16, 2021 · 4 comments
Open

clean build fails on latest version of Vite #3

dlqqq opened this issue May 16, 2021 · 4 comments

Comments

@dlqqq
Copy link

dlqqq commented May 16, 2021

Steps to reproduce

  • git clone into a fresh directory
  • Install dependencies
  • Run pnpm run build in project root and then in demo/

Error

[vite:compress] setAssetSource cannot be called in transform for caching reasons. Use emitFile with a source, or call setAssetSource in another hook.
file: /home/hydrocodone/Repositories/vite-plugin-compress/demo/public/test.svg
error during build:
Error: setAssetSource cannot be called in transform for caching reasons. Use emitFile with a source, or call setAssetSource in another hook.
    at error (/home/hydrocodone/Repositories/vite-plugin-compress/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/shared/rollup.js:5305:30)
    at throwPluginError (/home/hydrocodone/Repositories/vite-plugin-compress/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/shared/rollup.js:18040:12)
    at Object.error (/home/hydrocodone/Repositories/vite-plugin-compress/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/shared/rollup.js:18666:20)
    at Object.error (/home/hydrocodone/Repositories/vite-plugin-compress/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/shared/rollup.js:18209:38)
    at Object.setAssetSource (/home/hydrocodone/Repositories/vite-plugin-compress/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/shared/rollup.js:18228:29)
    at Object.transform (/home/hydrocodone/Repositories/vite-plugin-compress/dist/plugin.js:107:34)
    at async ModuleLoader.addModuleSource (/home/hydrocodone/Repositories/vite-plugin-compress/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/shared/rollup.js:18403:30)
    at async ModuleLoader.fetchModule (/home/hydrocodone/Repositories/vite-plugin-compress/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/shared/rollup.js:18459:9)
    at async Promise.all (index 1)
    at async ModuleLoader.fetchStaticDependencies (/home/hydrocodone/Repositories/vite-plugin-compress/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/shared/rollup.js:18485:34)
 ERROR  Command failed with exit code 1.

This could be caused by recent breaking change in Vite v2.3.0. Will submit PR for review.

@aleclarson
Copy link
Contributor

Thanks for investigating! Awaiting your PR :)

@dlqqq dlqqq mentioned this issue May 18, 2021
@wtachau
Copy link

wtachau commented Sep 9, 2021

Any update here? We're having this same issue!

@muuvmuuv
Copy link

Same issue here :/

@aleclarson
Copy link
Contributor

aleclarson commented Sep 27, 2021

It's fixed on the next branch, but the fix depends on #1675, which I haven't had time to write tests for.

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

4 participants