Razzle: Bring your own dependencies

Created on 14 Mar 2018  路  11Comments  路  Source: jaredpalmer/razzle

Razzle is awesome because of it's no-config-needed approach. Everything works out of the box.

To make this all possible, Razzle has a lot of dependencies. Currently, these dependencies are locked. It seems like they are locked since 2e68e7dd399131369aee51e3c1f3a27f40e7e940.

By locking these dependencies, it's hard for projects that use razzle to upgrade to a newer version of these dependencies. For example, eslint is currently locked at 4.5.0 while the latest version is 4.18.2. As stated in #404, old dependencies can become incompatible with other modules like eslint-config-airbnb.

If you run yarn add eslint, the newest version of eslint will be added to the project. But Razzle will still use the old version, because it's dependencies are locked. The only way to make Razzle use the new eslint is by changing the webpack config, but the old eslint will still be installed while it's never used.

Why were the Razzle dependencies locked? When they are loosened with a caret, it would be easier for users to update modules like eslint and babel. As long as dependencies uphold semver, updating them won't break Razzle.

stale

Most helpful comment

So for clarity, using the example for custom webpack config the completed file would look something like this:

'use strict';
const path = require('path');
module.exports = {
  modify(config, { target, dev }, webpack) {
    config.module.rules[0].use[0].options.eslintPath = path.resolve(__dirname, 'node_modules/eslint');
    return config;
  },
};

All 11 comments

Totally understand the frustration. Razzle runs on a lot of mission critical applications for my clients, so locking down deps is just a habit. When Babel 7 is released, I plan to do a large overhaul. I will consider relaxing them.

Feel free to submit a PR with the changes to eslint you'd like to see

Any ideas when this will get a npm tag so we can pull this as a dependency?

I have been working on 2. I think it鈥檚 about time to tag 0.8 as 1

Following on from @bartlangelaan's comment - I was also trying to use eslint-config-airbnb with Razzle. However, it relies on eslint ^4.9.0 and Razzle uses 4.5.0, so I've upgraded to 4.19.1 in my app and remapped Razzle's eslint to use my local app's:

config.module.rules[0].use[0].options.eslintPath = path.resolve(__dirname, 'node_modules/eslint');

Hope this helps.

@JP-GNL in which file did you put this?

Sorry, should have said: razzle-config.js in your app root.

So for clarity, using the example for custom webpack config the completed file would look something like this:

'use strict';
const path = require('path');
module.exports = {
  modify(config, { target, dev }, webpack) {
    config.module.rules[0].use[0].options.eslintPath = path.resolve(__dirname, 'node_modules/eslint');
    return config;
  },
};

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we'll re-open it.

Thank you @AndyArcherKG! I was fighting with this for a while, your solution works perfectly, didn't realize that was possible.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GouthamKD picture GouthamKD  路  3Comments

MaxGoh picture MaxGoh  路  4Comments

kkarkos picture kkarkos  路  3Comments

knipferrc picture knipferrc  路  5Comments

pseudo-su picture pseudo-su  路  3Comments