-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[Sage 9] Node v6.x path issue #1659
Comments
I've had problems with using newer versions of node. Using nvm to get working with node 0.12.x usually takes care of these issues (you may have to clear out your node_modules folder and run npm install again with 0.12.x). |
had same issue, except I fixed it by commenting out the line: var assetsPluginProcessOutput = function (assets) {
var name,
ext,
filename,
results = {};
for (name in assets) {
if (assets.hasOwnProperty(name)) {
// if (path.extname(assets[name]) === '') {
for (ext in assets[name]) {
if (assets[name].hasOwnProperty(ext)) {
filename = name + '.' + ext;
results[filename] = path.basename(assets[name][ext]);
}
}
// }
}
}
return JSON.stringify(results);
} |
As @jaredpalmer pointed it out, this is the line where it fails. Created a forum thread about that. Didn't expected that this is a bug. Regards |
That was on my list of issues with the current webpack implementation. This function I think the best solution would be to update src/libSage/Asset functions to use the default
This way, the Maybe some feedback from @QWp6t who worked on Asset.php and JsonManifest.php would help decide the next step. |
agreed — that's a decent chunk of the webpack config removed 👍 we can update the json manifest to account for this |
Not sure if this should be a separate issue or not, but seems possibly related. I noticed that
The normal |
@aaemnnosttv not sure either but can you try #1673 if it's not already in your codebase? i'm able to import and build font-awesome for prod, but run into issues with another npm dependency that has assets in a stylesheet |
Initially I added this if statement because in some situation (that I can't reproduce :-/ ) the assets array get passed to the function with filename "main.js" instead of entry names ("main", "customizer"). If
|
@retlehs @ptrckvzn, I popped in the log there in
Error starts with:
Thanks guys. Really enjoying webpack so far! Let me know if there is any more info I can provide to help. |
Your problem is not related to this issue. The assets output is as expected. I think it would be interesting that you start a new topic on how to import Font Awesome with npm and webpack on the discourse forum. I found this in one of my projects. Does it helps ? assets/styles/main.scss
|
@ptrckvzn That was it. I didn't realize I had to set that too. Thanks so much! |
@ptrckvzn or anyone else, can you help me understand this issue? Can you possibly provide me with a reduced testcase? I'm on Windows, and I've tried Node v5 and v6 both 32- and 64-bit variants. I'm not seeing any of these same problems as you guys at all. Once I can get access to an environment that has this issue, I'll gladly look into getting it fixed. This is an example of the assets.json that I get when running {
"main.js":"main_079d6de85fa826c1f1e9.js",
"main.css":"main_079d6de85fa826c1f1e9.css",
"customizer.js":"customizer_079d6de85fa826c1f1e9.js"
} Update: Just installed node v6 on my vagrant box and retested. Same thing. No issues. So I'm going to need more information on this one. |
Actually, I am not able to reproduce the issue here either, but I think it would be better to remove the |
Okay, I'll see about refactoring it while I work on this today. I'm closing this issue since nobody can seem to reproduce it. Thanks a bunch for your response! |
Sage 9.0.1 and FontAwesome 5 (@fortawesome/fontawesome-free-webfonts and see this).
Import from
Add variable to Works with |
Submit a feature request or bug report
What is the current behavior?
npm run build:production
is failingWhat is the expected or desired behavior?
Build should work.
Bug report
(delete this section if not applicable)
Please provide steps to reproduce, including full log output:
Using Node v6.x path is expecting a string
TypeError: Path must be a string. Received { js: 'scripts/main_ba96f3fab55a5e191f46.js' }
It is used here:
Please describe your local environment:
WordPress version: latest
OS: latest
NPM/Node version: v6.0.0 / 3.9.0
Where did the bug happen? Development or remote servers?
Dev server, when running
npm run build:production
Is there a related Discourse thread or were any utilized (please link them)?
Haven't found one
Other relevant information:
Replacing path.extname() with path.format() (which is expecting an object) will fix the issue.
The text was updated successfully, but these errors were encountered: