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

Support multiple webpack configurations #1397

Closed
pyk opened this issue Jun 18, 2020 · 5 comments 路 Fixed by #1677
Closed

Support multiple webpack configurations #1397

pyk opened this issue Jun 18, 2020 · 5 comments 路 Fixed by #1677
Labels
webpack Issues that involve the `webpack` bundler

Comments

@pyk
Copy link

pyk commented Jun 18, 2020

馃挕 Feature request

Overview and problem statement

It would be nice if wrangler support multiple webpack configurations.

The use case is when the user need to bundle static assets that runs in the browser.

Enabling this feature would greatly improve the developer experiences when publishing or developing Workers Sites locally.

Basic example

For example:

// Webpack config to bundle worker script
const webWorkerBundleConfig = {
    target: "webworker",
    // redacted
};

// Webpack config to bundle javascript assets that run in the browser
const javascriptBrowserBundleConfig = {
    target: "web",
    // redacted
};

module.exports = [javascriptBrowserBundleConfig, webWorkerBundleConfig];

#1047

@pyk
Copy link
Author

pyk commented Jun 18, 2020

My current approach is to use separate file for this:

  1. webpack.workers.js: webpack configuration to bundle workers script
  2. webpack.sites.js: webpack configuration to bundle static assets that run in the browser

On local development, I run the following command:

# terminal 1: to watch & bundle static asset based on changes
npx onchange 'src/pages/**/*.html' 'src/assets/**/*' -- npx webpack --config webpack.sites.js --mode=development

# terminal 2: to run workers sites locally
wrangler dev

To publish, I use the following command:

npx webpack --config webpack.sites.js --mode=production && wrangler publish -e production

@ashleymichal ashleymichal added this to the wrangler build milestone Jun 18, 2020
@stale
Copy link

stale bot commented Aug 18, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Aug 18, 2020
@stale
Copy link

stale bot commented Aug 25, 2020

This issue has been automatically closed because it has not had recent activity. You may re-open the issue if it is still relevant.

@stale stale bot closed this as completed Aug 25, 2020
@ashleymichal ashleymichal reopened this Sep 11, 2020
@stale stale bot removed the wontfix label Sep 11, 2020
@nataliescottdavidson nataliescottdavidson added the webpack Issues that involve the `webpack` bundler label Oct 8, 2020
@lizzo-tlg
Copy link

Up!

@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.

6 participants