Closed scambier closed 3 years ago
Fixed by following https://github.com/rollup/rollup/issues/1267
tl;dr: I needed to import Toastify from 'toastify-js'
(not import * as Toastify from 'toastify-js'
). Since TypeScript was unhappy with this, I also had to set allowSyntheticDefaultImports
to true
in my tsconfig.
The issue was clearly stated in the vite build --debug
log
I'm not sure if this issue is for Toastify or Vite, so I'm posting it in both projects.
I'm using Toastify in a Vue 3 app, built with Vite. I have 0 problem during development, but Toastify stops working once the app is built for production.
I have the following code:
Once built, the code looks like this (excerpt from the compiled file):
It looks like
Toastify({/**/})
has been replaced with$({/**/})
, but$
is never declared. Each time I callmyToastService.showToast()
, it throws the error