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

allow custom webpack config for Workers Sites projects #905

Closed
ashleymichal opened this issue Nov 25, 2019 · 7 comments · Fixed by #957
Closed

allow custom webpack config for Workers Sites projects #905

ashleymichal opened this issue Nov 25, 2019 · 7 comments · Fixed by #957
Assignees
Labels
feature Feature requests and suggestions good first issue Good for newcomers sites

Comments

@ashleymichal
Copy link
Contributor

ashleymichal commented Nov 25, 2019

$ wrangler build
⚠️  Workers Sites does not support custom webpack configuration files
✨  Built successfully, built project size is 11 KiB.

Thsi error message is historical; when wrangler implicitly looked at the root for a custom webpack config, it made sense to disable the functionality for sites since the root would likely contain a config for the app you were deploying, not for the workers site. with this change, though, we should allow custom webpack configs since you are required to declare them in your wrangler.toml. This should be as simple as removing a conditional somewhere in wranglerjs, we just need to triage it.

Originally posted by @ashleymichal in #847 (comment)

@ashleymichal ashleymichal changed the title allow custom webpack config for allow custom webpack config for Workers Sites projects Nov 25, 2019
@ashleymichal ashleymichal added feature Feature requests and suggestions good first issue Good for newcomers status - PR welcome sites labels Nov 25, 2019
@minddust
Copy link

minddust commented Dec 9, 2019

please correct me (never wrote any rust) but it looks like it's not just the warning which is wrong:

https://github.com/cloudflare/wrangler/blob/master/src/commands/build/wranglerjs/mod.rs#L177

    let custom_webpack_config_path = match &target.webpack_config {
        Some(webpack_config) => match &target.site {
            None => Some(PathBuf::from(&webpack_config)),
            Some(_) => {
                message::warn("Workers Sites does not support custom webpack configuration files");
                None
            }
        },

if webpack is given and worker site is activated then custom_webpack_config_path will be set to None.

this is the opposite of what the docs are stating:

... If you are using Workers Sites and want to specify your own webpack configuration, you will always need to specify this ...

https://developers.cloudflare.com/workers/tooling/wrangler/webpack/

@ashleymichal ashleymichal self-assigned this Dec 11, 2019
@ashleymichal
Copy link
Contributor Author

ashleymichal commented Dec 11, 2019

that's a good catch! i'll assign this to me and tackle it friday. sorry for the mismatch, we'll patch it up asap.

@darrenhebner
Copy link

Hello! It looks like this issue was fixed in #957, but I'm still seeing the error when attempting to publish a Workers Site with a custom webpack config.

I'm using Wrangler 1.6.0. I'm guessing we just need to wait for a new release?

@EverlastingBugstopper
Copy link
Contributor

That's correct @darrenhebner - you can also build from master using rust with cargo install --git "https://github.com/cloudflare/wrangler" --force (you may need to npm uninstall -g @cloudflare/wrangler if you previously installed with that)

@Cherry
Copy link

Cherry commented Feb 2, 2020

Is there any ETA for this to be published to npm? It's preventing using https://github.com/cloudflare/wrangler-action with a custom Workers Sites webpack config, and I'd rather not have to fork the wrangler action if at all possible!

@acoyfellow
Copy link

Why is this closed? Still seeing this issue

@zackbloom
Copy link
Contributor

@acoyfellow You might have to add context: __dirname, to your custom webpack config as I did.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Feature requests and suggestions good first issue Good for newcomers sites
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants