Skip to content
This repository was archived by the owner on Oct 17, 2020. It is now read-only.

Divert working files to a different directory (than the build one) #541

Closed
izaera opened this issue Mar 10, 2020 · 2 comments
Closed

Divert working files to a different directory (than the build one) #541

izaera opened this issue Mar 10, 2020 · 2 comments
Assignees

Comments

@izaera
Copy link
Member

izaera commented Mar 10, 2020

Bundler 3 is generating files in three directories:

  1. build/output: real output
  2. build/generated: generated JS files and webpack configuration
  3. build/webpack: output from webpack

In order to maintain compatibility with bundler 2 we may want to map output as:

  1. build
  2. work/generated
  3. work/webpack

So we'll provide a work-dir config option to do this.

@izaera izaera added this to the IFI-851 | Bundler 3.x milestone Mar 10, 2020
@izaera izaera self-assigned this Mar 10, 2020
@wincent
Copy link
Contributor

wincent commented Mar 10, 2020

For the lay person (ie. me), can you clarify what the difference between "generated" and "real output" is?

@izaera
Copy link
Member Author

izaera commented Mar 10, 2020

Generated are JS files that bundler 3 created to feed them to webpack and make everything glue together. Right now they are:

  1. webpack configuration (it is created in memory and passed to webpack, but the bundlers writes it for diagnostic purposes only)
  2. export entry point JS files: one file per entry point where we simply do a require to bridge AMD and webpack's bundle.

An example of 2 would be:

__MODULE__.exports = require('recharts');

This "magic" code will be processed by webpack and the require will end up transformed to a webpack_require that resolves to a module defined inside the webpack bundles.

The MODULE on the other hand, will be bound by the bundler (when AMD-wrapping the webpack bundles) in the final output so that the return from webpack_require is exported through our AMD loader.

It' the same scheme we use when adapting native framework apps.

izaera pushed a commit to izaera/liferay-js-toolkit that referenced this issue Mar 10, 2020
@izaera izaera closed this as completed Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants