question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cache / Babel issue on building

See original GitHub issue

https://www.npmjs.com/package/easy-import and my .babelrc file looks as follows:

{
    "presets": ["react-native"],
    "plugins": [
        "easy-import"
    ]
}

I use the above package in my projects (think of it as a lighter-weight facebook/node-haste.)

After running the following command:

npm run start -- --reset-cache & react-native run-ios my build starts as expected, and things work normally.

When I create a component such as the following:

// @provides Component
import React from 'react';
export default class Component extends React.Component {
}

and try to include it elsewhere in my code:

import Component from 'Component`

I get the following common error:

Unable to resolve module

screen shot 2016-06-20 at 9 50 16 am

I clear all the caches, follow the instructions and then randomly and occasionally things work. This is to say that I do have components working with the easy-import module, they just sometimes get ignored / can’t invalidate a cache that searches the dependency map.

How can we ensure that the babel plugins are being run on every save / live reload? I actually haven’t found a working solution to force a full compile every time yet.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
mmazzarolocommented, Nov 12, 2016

I used at least 3 babel plugins in the past that had the same problem with react-native, the last one is babel-plugin-module-resolver. Does anyone know if this caching issue can be fixed?

0reactions
DannyiCrackedcommented, Oct 31, 2016

I don’t think this issue can be closed as answered. Not being able to use npm modules properly in your build cycle is a huge problem. Just because there are alternatives, doesn’t mean it isn’t an issue.

@mkonicek @grabbou

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to clear babel cache? - Stack Overflow
If you are using a babel.config.js file which looks like below. You can turn off the cache by passing false to api.cache(false)
Read more >
Config Files - Babel.js
Since babel.config.json and .babelrc.json are static JSON files, it allows other tools that use Babel such as bundlers to cache the results of...
Read more >
Build Performance - webpack
Specific Tooling Issues. The following tools have certain problems that can degrade build performance: Babel. Minimize the number of preset ...
Read more >
node_modules/babel-loader - Gitlab
Note: Issues with the output should be reported on the Babel Issues tracker. ... cacheDirectory=true' ), the loader will use the default cache...
Read more >
Improving Webpack Performance via Caching
Improve Webpack build performance and significantly reduce build time with Webpack, Babel Loader, ESLint Plugin, and Stylelint Plugin ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found