Skip to content

Problem using react-table v7 in rails app #2048

Answered by knightbk
edsinclair asked this question in General
Discussion options

You must be logged in to vote

Aha. I think I figured it out. @edsinclair @ajaiy

I'm pretty sure its because Webpacker compiles node modules by default: https://github.com/rails/webpacker/blob/master/docs/v4-upgrade.md#excluding-node_modules-from-being-transpiled-by-babel-loader

Following the guide in that wiki, if you make the following change to https://github.com/edsinclair/rails-react-table-test/blob/master/config/webpack/environment.js it should work?

const nodeModulesLoader = environment.loaders.get('nodeModules');
if (!Array.isArray(nodeModulesLoader.exclude)) {
  nodeModulesLoader.exclude = nodeModulesLoader.exclude == null ? [] : [nodeModulesLoader.exclude];
}

nodeModulesLoader.exclude.push(/react-table/);

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@knightbk
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@knightbk
Comment options

@edsinclair
Comment options

@knightbk
Comment options

Answer selected by edsinclair
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants