akanix42 / meteor-css-modules

MIT License
92 stars 20 forks source link

Possible issues with flow-router #36

Closed aakagi closed 8 years ago

aakagi commented 8 years ago

It may not be due to this package, but I'll just explain my issue:

After adding flow-router to my react project, I suddenly started getting an error where my components were unable to locate their scss files in the same directory.

For example, I have the filetree - Navbar/{Navbar.jsx, Navbar.scss, Navbutton/Navbutton.jsx}

Then I get the error "Error: Cannot find module './Navbar.scss'" and it seems as though it's an NPM issue, where it's checking NPM for './Navbar.scss'.

// Custom Dependencies
import s from './Navbar.scss';
import NavButton from './NavButton/NavButton';

NavButton works properly still.

Again, this issue only arose when I started using Flow-Router and was not an issue before then.

Would appreciate any tips/pointers!

Edit: More info: The issue happens the moment I go from (in client/main.jsx)

Meteor.startup(() => {
  render(<App />, document.getElementById('render-target'));
});

to (in lib/router.js)

FlowRouter.route('/', {
  action() {
    mount(App);
  }
});
aakagi commented 8 years ago

Figured out a solution! I put my routes.js inside my imports folder instead of lib/routes.js, and then I just import the route in my client/main.jsx