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

Autoload JS files from /scripts/autoload/ doesn't work with import "./autoload/**/*" from main.js #2082

Closed
6 tasks
ancredigital opened this issue Jul 7, 2018 · 3 comments

Comments

@ancredigital
Copy link

Submit a feature request or bug report


What is the current behavior?

Files from resources/scripts/autoload/ are not being loaded by the import "./autoload/**/*" from main.js
I'm receiving an error on a fresh install. Nothing has been changed.

Here's the error I'm receiving in Terminal:
ERROR Failed to compile with 1 errors 8:35:29 PM

error in ./resources/assets/scripts/main.js

Module build failed: Module failed because of a eslint error.

/resources/assets/scripts/main.js
5:43 error Parsing error: Unterminated string constant

✖ 1 problem (1 error, 0 warnings)

What is the expected or desired behavior?

All files from resources/scripts/autoload/ should be loaded and for yarn build to be successful


Bug report

Please provide steps to reproduce, including full log output:

import "./autoload/**/*" frommain.js seems not to load files under /autoload/.

Please describe your local environment:

WordPress version: 4.9.6

OS: Ubuntu (64 bit) on Mac OS High Sierra Version 10.13.5

NPM/Node version: Node: v10.6.0

Where did the bug happen? Development or remote servers?

dev local

Is there a related Discourse thread or were any utilized (please link them)?

#1956


@entr
Copy link
Contributor

entr commented Jul 9, 2018

Make sure you save resources/assets/scripts/main.js after introducing/removing files from autoload directory

@knowler
Copy link
Member

knowler commented Jul 19, 2018

NPM/Node version: Node: v10.6.0

Use a lower version of Node, Sage currently is not compatible with Node 10.x (#2067).

I would recommend using nvm to switch between Node versions — as mentioned in the NPM Debugging Guidelines Post in the issue checklist that you did not fill out. Use NVM to install and use the current LTS version of Node (nvm install lts/* then nvm use lts/*).

I received a similar error, however, in my case it was because I broke the Webpack config file.

@MWDelaney
Copy link
Member

This hasn’t seen any action in a while. I’m closing it for now but we can re-open if the issue is still current.

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

4 participants