-
Notifications
You must be signed in to change notification settings - Fork 90
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
TypeError: Filename must be a string #5
Comments
I lied, this error is coming from the rewire plugin, not this plugin |
Well, I lied again. this error only seems to happen if I include this plugin. Still investigating... |
Might it be possible that you are using rewire.js along babel-plugin-rewire? If this is the case can you check whether the error remains if you change babel-loader?plugins=rewire&optional=runtime to |
I changed it to
What do you mean using rewire.js along with the plugin? We do this in plenty of places in the code:
Sorry for my density - I'm not familiar with the internals of rewire - I assumed this plugin did some magic to allow |
Tested in a blank project, simply adding this line:
Triggers the errors/warnings:
However, if I add this to the webpack config in the blank project:
Then the bundle is valid. More investigation required... |
Something is conflicting somewhere with babel and rewire. In the large project, what's getting built to the bundle is:
which throws the error |
Have you tried the latest version (0.1.3) of babel-plugin-rewire this should fix the problem with the wrapping of the default export |
To avoid conflicts with npm `require` module Inspired by speedskater#5
Phew, ok, looks like using the explicit name and the newest version works. |
I'm not sure what's causing this yet. I will close this bug if it turns out to be our fault. I included the babel rewire plugin in our webpack config:
When I run webpack (building our test bundle), I get:
The content of vendors.js aren't anything exciting:
The stack trace exits at
so I'm not sure what's originating the error. If I log inside that line to see what filename is it prints out a very large object that isn't immediately recognizable.
Does this plugin still work with regular require statements alongside es6 import statements? Actually, even if I make the contents of that file only
import "react";
it gives me the same error...Might be worth noting I'm using rewire-webpack, although this error still persists if I remove rewire-webpack it from my webpack plugins list.
The text was updated successfully, but these errors were encountered: