formatjs / babel-plugin-react-intl

Extracts string messages from React components that use React Intl.
http://formatjs.io/react/
Other
420 stars 122 forks source link

cache is not working properly #160

Closed dabit1gamma closed 5 years ago

dabit1gamma commented 6 years ago

For example, if you have a message like "hello" then this plugin will create it. If you change it per "hello!" it will be replaced. But if you change it again per "hello" then it will not be replaced. It's a critical bug.

Thanks

tomek-f commented 6 years ago

Turning off cacheDirectory (false) in babel-loader helped me a little with cache problems.

enzoferey commented 5 years ago

People coming here for Nextjs integration, this solved it for me:

// next.config.js

// Disable `next-babel-loader` caching if production
// That way `babel-plugin-react-intl` extracts messages properly
webpack: (config, { dev, isServer }) => {
    if (!dev && !isServer) {
        config.module.rules
            .filter(rule => rule.test.test(".js"))
            .forEach(rule => {
                rule.use.options.cacheDirectory = false;
            });
    }
}
longlho commented 5 years ago

close due to stale