Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

using babel-loader #3

Closed
tonykung06 opened this issue Dec 22, 2015 · 3 comments
Closed

using babel-loader #3

tonykung06 opened this issue Dec 22, 2015 · 3 comments
Assignees

Comments

@tonykung06
Copy link

I am wondering if this tool allows using various kinds of module loaders such as babel-loader, I tried to use that with babel-loader, but it seems skip the loader and not understand ES6 in the build.

@pago
Copy link
Contributor

pago commented Dec 22, 2015

Hi @tonykung06, I can't confirm that problem as we're using babel-loader in most of our projects and it worked quite well.

Could you maybe setup a small repository which shows the problem so that I can investigate why it happens to you?

@pago pago self-assigned this Dec 22, 2015
@tonykung06
Copy link
Author

@pago Thanks for the reply :) I figured out what was happening

// Those options will be the same for every variant.
var baseOptions = {
    devtool: 'eval'
};

the base options are all ignored when I used
createVariants(baseOptions, variants, createConfig);

So I moves all my webpack configs from baseOptions to the createConfig() and let it return the whole complete set of configs, then it works.

@pago
Copy link
Contributor

pago commented Dec 23, 2015

@tonykung06 thanks the feedback! That indeed explains it all: its a documentation error.

The baseOptions are combined with each of the variants and then passed together as a single object to the createConfig callback.
Our use case for that is for options which are the same for all variants but still dynamic, i.e. they're being created from the environment or command line arguments or the result of some executed command or from reading an additional configuration file.

So, for each variant, the result of Object.assign({}, baseConfig, variant) is being passed to createConfig which should then return a valid Webpack configuration (or a Promise of such a configuration).

I'll adjust the documentation and make that concept clearer.

Again, thank you for the feedback! Please let me know if you have any further questions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants