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
Unexpected token with webpack after upgrade to 2.0.0 #192
Comments
Could you show the original code? This seems like an issue in the transform |
Looks like this reduced version fails: import {createContext} from 'preact';
export interface Assets {}
export function assetsFromModelData(mapData: unknown): Assets {
return {};
}
export const AssetsContext = createContext({} as Assets); And this does not: import {createContext} from 'preact';
export interface Assets {}
export function assetsFromModelData(mapData: unknown): Assets {
return {};
}
export const AssetsContext = createContext({}); |
@bz2 Got a fix lined up for you |
@JoviDeCroock Thanks for having a look! I tried hacking you change in locally, which got babel through compiling but then lead to a complaint from |
Found another potential bug so I'll be releasing 0.2.2 in a bit |
Yup, unfortunately looks like I reduced the real code down a bit to far, the actual line is: export const AssetsContext = createContext<Assets>({} as Assets); So, the AST also has a |
Looks like it should be sensible to leverage |
It doesn't seem to give me any exceptions since these are stripped out by @babel/typescript normally. Tried in my own example and no issues. |
I may be wrong on the cause, will make a proper standalone reproduction. |
@JoviDeCroock I can confirm that 0.2.2 works for me. |
@bz2 Awesome, very glad to hear that! Btw you can pass a second argument to the babel plugin called |
I have a project with a mostly working refresh setup using prefesh and webpack and hooks, and a test upgrade to the last version no longer functions. Instead throws a parse error during build.
Changes made
In
package.json
:In
babel.config.js
:(note the env change is to stop the complaint about "React Refresh Babel transform should only be enabled in development environment." which should probably say "Preact Refresh Babel)
No meaningful changes to
webpack.config.babel.js
but does have some other plugins as well asnew PreactRefreshPlugin()
.Error message
Might be the tsx, or the context, or something else that's causing the unhappiness?
The text was updated successfully, but these errors were encountered: