Production site unable to load node module assets

Hi,

I’ve just set up a production site on flywheel, but for some reason the site isn’t able to load resources from the node_modules directory. All other stylesheets and scripts have been successfully loaded. This is only an issue on production. I’ve already tried changing the permissions on the files in question, and changing the loading order in functions.php.

The specific node module that does not get loaded in slick-carousel: slick - the last carousel you'll ever need

Here’s a screenshot of the error(s) in the inspector console:

Has anyone else run into a similar issue and found a way to resolve it?

Thanks!

Jill

Are you trying to load it from the theme folder?

If so, can you show us the line of your functions.php that loads it and a print of your theme folder where the files are?
Have you checked for the references to be sure they are right?

Hi @jillii,

Right now node_modules is excluded when Pushing from Local to Flywheel since it’s usually only used for development when working with websites.

We recommend using something like Webpack to bundle all of the modules in a file outside of node_modules.

1 Like

Sure! Here’s where I load the stylesheet:

wp_enqueue_style( 'slick-css', get_template_directory_uri() . '/node_modules/slick-carousel/slick/slick.css');

And this line loads the jquery

wp_enqueue_script( 'slick', get_template_directory_uri() . '/node_modules/slick-carousel/slick/slick.min.js', array('jquery'), false, true );

It’s working on my development site, just not production for some reason.

Thanks for your help,

Jill

Whoops, just read your second message. Thanks for your response - (I’d like to make a request to load node module in flywheel live sites!)

Jill

2 Likes