emaphp / underscore-template-loader

A Underscore and Lodash template loader for Webpack
MIT License
104 stars 24 forks source link

Are lodash and underscore modules should be in dependencies? #21

Closed hacke2 closed 8 years ago

hacke2 commented 8 years ago

I use, underscore-template-loader in webpack,but webpack throw a error:

ERROR in Cannot find module 'lodash'
 @ ./src/public/js/index.js 5:10-36

I find source index.js

try {
    var _ = require('underscore');
} catch (e) {
    var _ = require('lodash');
}

and package.json

"dependencies": {
    "fastparse": "^1.1.1",
    "loader-utils": "^0.2.11"
  },
  "devDependencies": {
    "chai": "^3.2.0",
    "chai-string": "^1.1.2",
    "istanbul": "^0.3.18",
    "mocha": "^2.2.5",
    "underscore": "^1.8.3"
  },

I think 'lodash' and 'underscore' should be in dependencies.

shirleyYing commented 8 years ago

I get the same error

emaphp commented 8 years ago

Sorry for the inconvenience. This error was triggered by file-loader.js using an unused dependency, in this case, lodash. Update your application dependency to use v0.7.3.

lodash and underscore shouldn't be on dependencies. This is something I decided long ago because there's no point in using them both and is always better to let the developer pick which one is more suitable.