question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to mix output .js file to the parent directory

See original GitHub issue
  • Laravel Mix Version: 1.4.5
  • Node Version: 8.2.1
  • NPM Version: 5.4.2
  • OS: macOS 10.12.6

I’ve created a src folder within a WordPress themes directory for all build scripts, node modules, etc (so I can hide it when publishing to the server).

In that folder I have webpack.mix.js:

mix.sass('sass/style.scss', '../style.css')
	.js('js/script.js', '../script.js')

This publishes the style.css in the themes (parent) directory as required, but when I do the same for the script.js file it publishes it in the current src folder but creates a list of all folders from my system Users directory Users/jackbarham/Code/etc/.../etc/theme/src/script.js all the way to the output file.

I’ve tried altering paths, but I can’t get it to work or understand why it’s working for CSS but not JS.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

26reactions
eliamariutticommented, Jul 5, 2018

I did sth like that and it’s working. mix.setPublicPath('../') .js('resources/assets/js/app.js', 'js') .sass('resources/assets/sass/app.scss', 'css');

5reactions
renanfenrichcommented, Mar 20, 2018

This worked for me: mix.setPublicPath(‘…/parent-folder/’);

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to mix output .js file to the parent directory · Issue #1220
js file it publishes it in the current src folder but creates a list of all folders from my system Users directory Users/jackbarham/Code/etc/......
Read more >
Unable to locate Mix file: /js/app.js. - Laracasts
When i'm deploying my site to Laravel Forge, it give me an error saying "Unable to locate Mix file" . locally is fully...
Read more >
How to copy static files to build directory with Webpack?
In Gulp I have task which copies all files and folders from /static/ folder to /build/ folder. How to do the same with...
Read more >
CoffeeScript
js files are in a folder where the nearest parent package.json file contains "type": "module" . Because the runtime is evaluating the generated...
Read more >
4 Reasons Why Your Source Maps are Broken - Sentry Blog
This happens when a browser or tool downloads a compiled file (e.g., script.min.js ), then attempts to fetch its corresponding source map ( ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found