Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Bower integration in react-starter-kit #7

Closed
hokkos opened this issue Nov 27, 2014 · 2 comments
Closed

Bower integration in react-starter-kit #7

hokkos opened this issue Nov 27, 2014 · 2 comments

Comments

@hokkos
Copy link

hokkos commented Nov 27, 2014

Hi,
I try to integrate some bower packages in a boilerplate project : react-starter-kit that uses webpack.
I setted up this branch to try it :
https://github.com/hokkos/react-starter-kit/tree/BowerIntegration
It seems the require('d3') is correct in the entry javascript file : src/app.js, but not in a nested javascript file : src/components/Link.js

I can't make it works. If you have an idea, thanks a lot.

@lpiepiora
Copy link
Owner

Hi,

I don't think this issue is related to bower-webpack-plugin, I guess it doesn't even run.

I'm guessing, this code is executing before, and this is from where the error is reported:

var originalJsTransform = require.extensions['.js'];
var reactTransform = function(module, filename) {
  if (filename.indexOf('node_modules') === -1) {
    var src = fs.readFileSync(filename, {encoding: 'utf8'});
    src = ReactTools.transform(src, {harmony: true, stripTypes: true});
    module._compile(src, filename);
  } else {
    originalJsTransform(module, filename);
  }
};
require.extensions['.js'] = reactTransform;

The bower-webpack-plugin will only resolve bower components, as a part of Webpack resolving process.

@hokkos
Copy link
Author

hokkos commented Dec 2, 2014

Ok thanks, I will look into that. Sorry for the trouble.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants