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

Default value of the --filename parameter results in broken build if scoped package name is used #4311

Closed
MewesK opened this issue Jul 18, 2019 · 3 comments
Labels

Comments

@MewesK
Copy link
Contributor

MewesK commented Jul 18, 2019

Version

3.9.3

Reproduction link

https://github.com/MewesK/vue-cli-scoped-lib-bug

Environment info

This bug can be found in all versions (3.0 - 4.0 alpha) and all environments.

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
  Binaries:
    Node: 11.14.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.15.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.7.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.18362.1.0
  npmPackages:
    @fortawesome/vue-fontawesome: ^0.1.6 => 0.1.6
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-plugin-transform-vue-jsx:  1.0.0
    @vue/babel-preset-app:  3.8.0
    @vue/babel-preset-jsx:  1.0.0
    @vue/babel-sugar-functional-vue:  1.0.0
    @vue/babel-sugar-inject-h:  1.0.0
    @vue/babel-sugar-v-model:  1.0.0
    @vue/babel-sugar-v-on:  1.0.0
    @vue/cli-overlay:  3.8.0
    @vue/cli-plugin-babel: ^3.7.0 => 3.8.0
    @vue/cli-plugin-eslint: ^3.7.0 => 3.8.0
    @vue/cli-plugin-unit-jest: ^3.7.0 => 3.8.0
    @vue/cli-service: ^3.7.0 => 3.8.0
    @vue/cli-shared-utils:  3.8.0
    @vue/component-compiler-utils:  2.6.0
    @vue/eslint-config-airbnb: ^4.0.0 => 4.0.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/test-utils: 1.0.0-beta.29 => 1.0.0-beta.29
    @vue/web-component-wrapper:  1.2.0
    bootstrap-vue: ^2.0.0-rc.26 => 2.0.0-rc.21
    eslint-plugin-vue: ^5.2.2 => 5.2.2
    jest-serializer-vue:  2.0.2
    portal-vue:  2.1.4
    vue: ^2.6.10 => 2.6.10
    vue-cli-webpack:  1.0.0
    vue-clipboard2: ^0.3.0 => 0.3.0
    vue-eslint-parser:  2.0.3
    vue-functional-data-merge:  2.0.7
    vue-hot-reload-api:  2.3.3
    vue-jest:  3.0.4
    vue-loader:  15.7.0
    vue-router: ^3.0.3 => 3.0.6
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.6.10 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

Run "npm run build" and look at the "dist" folder

What is expected?

I expect to see the following files:
dist/vue-cli-scoped-lib-bug.common.js;
dist/vue-cli-scoped-lib-bug.css;
dist/vue-cli-scoped-lib-bug.umd.js;
dist/demo.html

What is actually happening?

I see the following files:
dist/@test/vue-cli-scoped-lib-bug.common.js;
dist/@test/vue-cli-scoped-lib-bug.css;
dist/@test/vue-cli-scoped-lib-bug.umd.js;
dist/demo.html


The proposed fix would be in file resolveLibConfig.js line 27. Just change "filename = filename || libName" to "filename = filename || libName.replace(/^@. //, '')" to strip the scope in case the package name is used as the filename prefix.

@MewesK
Copy link
Contributor Author

MewesK commented Jul 19, 2019

I don't mind providing a pull request if that speed things up for you guys. Just tell for which branch (v3?).

@haoqunjiang
Copy link
Member

dev branch and we'll backport it to v3 by cherry-picking. Thanks in advance!

@MewesK
Copy link
Contributor Author

MewesK commented Jul 22, 2019

FYI: It seems as the WC mode has the same issue. I will look into it and provide a PR for that as well this weekend, after getting the unit tests to work. Sorry that I haven't checked it earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants