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

Add example of external dependencies #3

Closed
kcrwfrd opened this issue May 5, 2016 · 2 comments
Closed

Add example of external dependencies #3

kcrwfrd opened this issue May 5, 2016 · 2 comments

Comments

@kcrwfrd
Copy link

kcrwfrd commented May 5, 2016

Figuring out how to include Lodash as a dependency in my library tripped me up quite a bit. I finally found guidance from http://survivejs.com/webpack_react/authoring_libraries/:

{
  devtool: 'source-map',
  output: {
    path: config.paths.dist,
    libraryTarget: 'umd',
    library: config.library
  },
  entry: config.paths.src,
  externals: {
    react: 'react'
    // Use more complicated mapping for lodash.
    // We need to access it differently depending
    // on the environment.
    lodash: {
      commonjs: 'lodash',
      commonjs2: 'lodash',
      amd: '_',
      root: '_'
    }
  },}
}
krasimir pushed a commit that referenced this issue May 6, 2016
@krasimir
Copy link
Owner

krasimir commented May 6, 2016

Interesting. I didn't know that we may pass an object as a value in the externals. I updated the README so it contains such example. Thanks.

@krasimir krasimir closed this as completed May 6, 2016
@kcrwfrd
Copy link
Author

kcrwfrd commented May 6, 2016

👍

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

2 participants