Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load plugin using babel-loader #279

Closed
dariye opened this issue Oct 26, 2016 · 5 comments
Closed

Load plugin using babel-loader #279

dariye opened this issue Oct 26, 2016 · 5 comments

Comments

@dariye
Copy link

dariye commented Oct 26, 2016

Having issues loading babel-plugin-import using the modifyWebpackConfig function. It is a modular import library. I want to use it to import antd modules(like so)

My kyt.config.js file.

// Base kyt config.
// Edit these properties to make changes.


modifyWebpackConfig: (baseConfig, options) => {
  /* *
  * Add Plugins 
  */

  const babelLoader = baseConfig.module.rules.find(loader => loader.loader === 'babel-loader');
  babelLoader.options.plugins.push(["import", { libraryName: "antd", style: "css" }]);

  return baseConfig;
}

module.exports = {
  reactHotLoader: true,
  debug: false,
};
@tizmagik
Copy link
Contributor

Hey @PaulTheAlien sorry you're having trouble! What is the error you get? Do you have a repo we could check out and reproduce the issue?

@dariye
Copy link
Author

dariye commented Oct 27, 2016

@tizmagik thanks for getting back. There's no error per se just that it isn't loading the compiled assets.

Here's a screenshot
screen shot 2016-10-26 at 10 00 59 pm

I guess I'm wondering if there's another way to add a plugin.

@tizmagik
Copy link
Contributor

Without having a sample repo to check out, it's hard to say what's going on. But, if what you've pasted is your kyt.config.js file then it doesn't look quite right, make sure that your modifyWebpackConfig function is defined as part of module.exports:

module.exports = {
  reactHotLoader: true,
  debug: false,
  modifyWebpackConfig: (baseConfig, options) => {
    const babelLoader = baseConfig.module.rules.find(loader => loader.loader === 'babel-loader');
    babelLoader.options.plugins.push(["import", { libraryName: "antd", style: "css" }]);

    return baseConfig;
  }
};

@dariye
Copy link
Author

dariye commented Oct 27, 2016

@tizmagik thank you that worked. I'll go ahead and close this. Awesome library by the way!

@dariye dariye closed this as completed Oct 27, 2016
@jaredmcdonald
Copy link
Contributor

@PaulTheAlien - also wanted to note that we are evaluating some options to make babel configuration smoother, take a look at #250 and #134

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

No branches or pull requests

3 participants