8000 Optional externals · Issue #339 · webpack/webpack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Optional externals #339
Closed
Closed
@kmalakoff

Description

@kmalakoff

Hello,

I'm moving over my libraries to use webpack for a universal loader for the browser and Node.js. It's really great!

I have been scouring to find our how to make a dependency optional in webpack. Two cases:

  1. jquery - it is optional on the server
  2. stream (well, readable stream) - it is so large so I want it to be optional on the browser

If I require either, they get pulled into my build or if I use externals, they are added to the factory call like:

exports["kb"] = factory(require("underscore"), require("backbone"), require("moment"), require("stream"));

Is there a way to require these libraries in my library, but not make them a hard dependency?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0