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

setPublicPath() not working properly for mix.js() output #3231

Closed
sauladam opened this issue Mar 14, 2022 · 1 comment · May be fixed by #3283
Closed

setPublicPath() not working properly for mix.js() output #3231

sauladam opened this issue Mar 14, 2022 · 1 comment · May be fixed by #3283

Comments

@sauladam
Copy link

sauladam commented Mar 14, 2022

  • Laravel Mix Version: 6.0.43 (npm list --depth=0)
  • Node Version (node -v): 17.2.0
  • NPM Version (npm -v): 8.1.4
  • OS: Ubuntu 20.04

Description:

mix.setPublicPath() shaves off the first portion of the output path of mix.js() only if it set to a variant of "one directory up". So the same goes for

mix.setPublicPath("../")
mix.setPublicPath("..")
mix.setPublicPath(path.resolve(__dirname, "../"))
mix.setPublicPath(path.resolve(__dirname, "../../root"))

Steps To Reproduce:

Having a project structure like this:

root
 - /admin
    - /resources
    - /assets
    - webpack.mix.js

With a Mix setup like this:

mix.setPublicPath("../")
    .js("resources/js/index.js", "admin/assets/js/")
    .css("resources/css/style.css", "admin/assets/css")

creates the following output:

root
  -/admin
    -/assets
      - /css
        - style.css
  -/assets
    - /js
      -  index.js

What I would expect:

root
  - /admin
    - /assets
      - /css
        - style.css
      - /js
       -  index.js

This does not seem to happen in any other constellation, so mix.setPublicPath("../..") or mix.setPublicPath("foo/bar") work as expected.

Might be related to #3106

@sauladam
Copy link
Author

Self-closing this issue because I feel like it's too specific and too much of an edgecase to be overly useful or worth investigating. Save the energy for actual issues :)

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

Successfully merging a pull request may close this issue.

1 participant