Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

wranglerjs is too rigid in what version of webpack it uses to build projects #1558

Closed
ashleymichal opened this issue Sep 14, 2020 · 5 comments · Fixed by #1677
Closed

wranglerjs is too rigid in what version of webpack it uses to build projects #1558

ashleymichal opened this issue Sep 14, 2020 · 5 comments · Fixed by #1677
Labels
webpack Issues that involve the `webpack` bundler

Comments

@ashleymichal
Copy link
Contributor

from @1000hz : the parser webpack 4 uses (acorn) doesn't support optional chaining / nullish coalescing operators. wranglerjs uses its own version of webpack (4.x). TypeScript target ES2020/ESNext doesn't transpile these operators
webpack 5 (which has been in beta forever) uses a newer version of acorn with support for these operators
but there's no way to override what version of webpack wrangler will use

@ashleymichal ashleymichal added category - maintenance webpack Issues that involve the `webpack` bundler labels Sep 14, 2020
@ashleymichal ashleymichal added this to the wrangler build milestone Sep 14, 2020
@1000hz
Copy link

1000hz commented Sep 14, 2020

I think the long-term solution to this problem is to have wrangler defer building to project scripts, i.e.
if there's a package.json file

npm run wrangler:build
npm run build    # if above doesn't exist

or if there's a cargo.toml file

cargo run wrangler:build
cargo build    # if above doesn't exist

and only fallback to using a bundled version of webpack if none of these exist.

@caass
Copy link
Contributor

caass commented Sep 23, 2020

Supporting arbitrary scripts seems like a really good idea actually, and would allow people to choose their own JS bundling tools (e.g. rollup, etc).

@Gowee
Copy link

Gowee commented Jan 8, 2021

It turns out that wrangler installation comes with wrangler-js which has webpack 4.33.0 built-in.

I can build my project successfully with webpack 5.x. But wrangler dev or wrangler build invokes its internal old version regardless. Is there any way to let wrangler use my manually built output?

@xtuc
Copy link
Member

xtuc commented Jan 26, 2021

Once #1677 is merged, we plan to support any version of webpack

@xortive
Copy link
Contributor

xortive commented Feb 25, 2021

closing since this is addressed by #1677, which will be going out as part of an RC in the near future

@xortive xortive closed this as completed Feb 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
webpack Issues that involve the `webpack` bundler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants