0

i'm using the vuejs cli webpack template. My URL's are not working properly, for example:

<link rel="..." href="/static/img/favicons/apple-icon-57x57.png">

This works fine on my development server, but not on my production server -> (404 file not found).
And if i try this on my dev server:

$.ajax({
        type: 'POST',
        url: '/static/php/process.php',
        data: term_formData
    })

(main.js), url not working.(404 file not found)

I already changed the webpack option: assetsPublicPath.

The Webpack config/index.js file:

  build: {
    // Template for index.html
    index: path.resolve(__dirname, '../dist/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',

assetsPublicPath: '/vueapp/dist/',

    ...

Production server: http://localhost/vueapp/dist/
Development server: http://localhost:8080/

Thanks in advance =)

2
  • assetsSubDirectory: './static'. This happens because you haven't placed your application in the web root, which the template assumes. The other solution is to make vueapp/dist your web root in your Apache/Nginx config. Commented Jan 10, 2018 at 19:11
  • Ah okay, thank you very much :) Commented Jan 10, 2018 at 20:04

1 Answer 1

1

Set assetsSubDirectory: './static'. This happens because you haven't placed your application in the web root, which the template assumes. The other solution is to make vueapp/dist your web root in your Apache/Nginx config.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.