Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected reserved word #6

Closed
A11oW opened this issue Dec 24, 2015 · 2 comments
Closed

SyntaxError: Unexpected reserved word #6

A11oW opened this issue Dec 24, 2015 · 2 comments

Comments

@A11oW
Copy link

A11oW commented Dec 24, 2015

Hi. when I try run test with 'jest-webpack-alias', he has error

● Runtime Error
SyntaxError: Unexpected reserved word

This error in file webpackInfo.js on line 17 var webpackSettings = require(webpackFile);

I don't understand why this happening. Help please.

@mwolson
Copy link
Owner

mwolson commented Dec 25, 2015

jest-webpack-alias doesn't support require statements with vars in the parameter. We're not able to run an interpreter to resolve the contents of a var. It can only be a string.

@mwolson mwolson closed this as completed Dec 25, 2015
mwolson pushed a commit that referenced this issue Jan 12, 2016
…parameter

- Export resolve function
- Ensure that webpack globals are configured before attempting resolve
- Ignore falsy arguments to require statements returned from AST parser
- README: Document resolve function
- README: Simplify setup example
@mwolson
Copy link
Owner

mwolson commented Jan 12, 2016

I've made this case slightly easier to deal with by exporting a resolve function. Here's an example of how to use it:

var resolve = require('jest-webpack-alias').resolve;
var webpackSettings = require(resolve(webpackFile, __filename));

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

No branches or pull requests

2 participants