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

Disabling hash from filename / build ignores assetsDir #1753

Closed
CoolGoose opened this Issue Jul 4, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@CoolGoose
Contributor

CoolGoose commented Jul 4, 2018

Version

3.0.0-rc.3

Reproduction link

https://codepen.io/anon/pen/zaXgNz

Steps to reproduce

Setup vue-cli , and use the setup of vue.config.js from the link above.

What is expected?

To have dist/assets/app.css

What is actually happening?

Without specifying the assets folder manually in the filename it ignores the assetsDir option.

@Akryum

This comment has been minimized.

Show comment
Hide comment
@Akryum

Akryum Jul 4, 2018

Member

You mean the extracted CSS isn't under assetsDir?

Member

Akryum commented Jul 4, 2018

You mean the extracted CSS isn't under assetsDir?

@CoolGoose

This comment has been minimized.

Show comment
Hide comment
@CoolGoose

CoolGoose Jul 4, 2018

Contributor

@Akryum
That's correct, the CSS and JS aren't under assetsDir. Hence the hack of adding assetsDir + filename in chainWebpack and configureWebpack.

It should just work with

configureWebpack: {
    output: {
      filename: "[name].js",
      chunkFilename: "[name].js"
    }
  },

and not with

configureWebpack: {
    output: {
      filename: assetsDir + "/[name].js",
      chunkFilename: assetsDir + "/[name].js"
    }
  },

Or is the assetsDir not supposed to apply anymore once you manually overwrite the filename / chunkFilename ?

Contributor

CoolGoose commented Jul 4, 2018

@Akryum
That's correct, the CSS and JS aren't under assetsDir. Hence the hack of adding assetsDir + filename in chainWebpack and configureWebpack.

It should just work with

configureWebpack: {
    output: {
      filename: "[name].js",
      chunkFilename: "[name].js"
    }
  },

and not with

configureWebpack: {
    output: {
      filename: assetsDir + "/[name].js",
      chunkFilename: assetsDir + "/[name].js"
    }
  },

Or is the assetsDir not supposed to apply anymore once you manually overwrite the filename / chunkFilename ?

@Akryum

This comment has been minimized.

Show comment
Hide comment
@Akryum

Akryum Jul 4, 2018

Member

Or is the assetsDir not supposed to apply anymore once you manually overwrite the filename / chunkFilename ?

Yes, because we don't know what you really want. By default we set filename to assetsDir + '/css/[name].[contenthash:8].css', so if you overwrite it well it doesn't have assetsDir in it.

What you should do in vue.config.js:

module.exports = {
  css: {
    extract: {
      filename: 'my-assets/css/[name].css',
      chunkFilename: 'my-assets/css/[id].css'
    }
  }
}

I'm not sure if it's a good idea to modify the options the developer set up in vue.config.js since maybe he wants to put the css somewhere else. @yyx990803 any thoughts?

Member

Akryum commented Jul 4, 2018

Or is the assetsDir not supposed to apply anymore once you manually overwrite the filename / chunkFilename ?

Yes, because we don't know what you really want. By default we set filename to assetsDir + '/css/[name].[contenthash:8].css', so if you overwrite it well it doesn't have assetsDir in it.

What you should do in vue.config.js:

module.exports = {
  css: {
    extract: {
      filename: 'my-assets/css/[name].css',
      chunkFilename: 'my-assets/css/[id].css'
    }
  }
}

I'm not sure if it's a good idea to modify the options the developer set up in vue.config.js since maybe he wants to put the css somewhere else. @yyx990803 any thoughts?

@CoolGoose

This comment has been minimized.

Show comment
Hide comment
@CoolGoose

CoolGoose Jul 4, 2018

Contributor

@Akryum

Well i would assume that a setting called assetsDir , is still used when overwriting the filename
I understand your reasoning though. Maybe an heads up in the documentation ?

Contributor

CoolGoose commented Jul 4, 2018

@Akryum

Well i would assume that a setting called assetsDir , is still used when overwriting the filename
I understand your reasoning though. Maybe an heads up in the documentation ?

@vuejs vuejs deleted a comment from CoolGoose Jul 4, 2018

@vuejs vuejs deleted a comment from CoolGoose Jul 4, 2018

@Akryum

This comment has been minimized.

Show comment
Hide comment
@Akryum

Akryum Jul 4, 2018

Member

Maybe an heads up in the documentation ?

Feel free to PR! 😸

Member

Akryum commented Jul 4, 2018

Maybe an heads up in the documentation ?

Feel free to PR! 😸

CoolGoose added a commit to CoolGoose/vue-cli that referenced this issue Jul 4, 2018

assetsDir is ignored when using custom filenames
trying to cover vuejs#1753 with this explanation

Akryum added a commit that referenced this issue Jul 4, 2018

assetsDir is ignored when using custom filenames (#1757)
trying to cover #1753 with this explanation

Akryum added a commit that referenced this issue Jul 4, 2018

docs: assetsDir is ignored when using custom filenames (#1757)
trying to cover #1753 with this explanation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment