Giter VIP home page Giter VIP logo

Comments (3)

sokra avatar sokra commented on April 16, 2024

The --options part either takes a json file .json or a node.js module .js.

If you do it with a .json file only options that are valid json are supported...

For options which include invalid json, i.e. RegExps or Functions you have to use a .js file:

module.exports = {
  // options
};

It's required like any other module in node.js so it may contain any code as long it exports an options object.


The best solution for blending a lodash library, which is already loaded in the browser, into webpack is to provide a web replacement.

_ = require 'lodash'

It loads the lodash library from node_modules if running in node.js.

You can provide a simple module which is loaded in the webpack build:

module.exports = window.lodash;

and save it under .../web_modules/lodash.js.

Requiring lodash will that load this module, which exports the lodash lib already loaded.


Another, less pretty, option is the write: var _ = this._ || require.valueOf()('lodash').

The require.valueOf() will be ignored by webpack, but work in node.js. ;)

from webpack.

sokra avatar sokra commented on April 16, 2024

Is this solved? Can I close it?

from webpack.

Meettya avatar Meettya commented on April 16, 2024

Oh, sure, thank you!

from webpack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.