jedwards1211 / meteor-imports-webpack-plugin

Webpack plugin to import and use Meteor packages like if they were real NPM packages.
MIT License
25 stars 10 forks source link

error: var packageName = /^packages\/(.+)\.js$/.exec(pckge.path)[1]; #2

Closed rickmed closed 8 years ago

rickmed commented 8 years ago

Hey. Cool library. I'm getting this error on npm run client

var packageName = /^packages\/(.+).js$/.exec(pckge.path)[1]; ^

TypeError: Cannot read property '1' of null

rickmed commented 8 years ago

I got it to work like this (meteor 1.3.2):

on entry.js:

import 'meteor-imports' const { Mongo } = Package.mongo const { Tracker } = Package.tracker const { Meteor } = Package.meteor

luisherranz commented 8 years ago

@rickmed I am glad this is useful.

If you find the fix make a PR and I will accept it.

gitTerebi commented 8 years ago

I just want to add another reason for this error is when it tries to package css files!

merged-stylesheets.css C:\repo\ReactJS_seedProject\node_modules\meteor-imports-webpack-plugin\index.js:92 var packageName = /^packages\/(.+).js$/.exec(pckge.path)[1];

The regex fails,

The solution is to delete all the CSS files in the meteor directory, or to fix code so it ignores css bundles?

luisherranz commented 8 years ago

I think it could be possible to ignore css files. Could you please do a PR?

zvictor commented 8 years ago

I find it problematically with both CSS and the main app file. Those are not inside /packages/ and therefore the exec returns null. I am working in a fix for it.

jedwards1211 commented 8 years ago

fixed by #11 Okay, the fix is published as 1.1.1!