vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.75k stars 6.33k forks source link

Plugins from devDependencies are trying to load on production #5206

Open padinko opened 4 years ago

padinko commented 4 years ago

Version

4.2.2

Environment info

Environment Info:
  System:
    OS: macOS Mojave 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
  Binaries:
    Node: 12.16.1 - /usr/local/bin/node
    Yarn: 1.19.2 - /usr/local/bin/yarn
    npm: 6.13.4 - /usr/local/bin/npm
  Browsers:
    Chrome: 80.0.3987.116
    Firefox: 72.0.2
    Safari: 12.1.1
  npmPackages:
    @kazupon/vue-i18n-loader:  0.5.0 
    @nuxt/vue-app:  2.11.0 
    @nuxt/vue-renderer:  2.11.0 
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.1.2 
    @vue/babel-preset-app:  4.2.2 
    @vue/babel-preset-jsx:  1.1.2 
    @vue/babel-sugar-functional-vue:  1.1.2 
    @vue/babel-sugar-inject-h:  1.1.2 
    @vue/babel-sugar-v-model:  1.1.2 
    @vue/babel-sugar-v-on:  1.1.2 
    @vue/cli-overlay:  4.2.2 
    @vue/cli-plugin-babel: ^4.2.2 => 4.2.2 
    @vue/cli-plugin-e2e-cypress: ^4.2.2 => 4.2.2 
    @vue/cli-plugin-eslint: ^4.2.2 => 4.2.2 
    @vue/cli-plugin-router:  4.2.2 
    @vue/cli-plugin-unit-jest: ^4.2.2 => 4.2.2 
    @vue/cli-plugin-vuex:  4.2.2 
    @vue/cli-service: ^4.2.2 => 4.2.2 
    @vue/cli-shared-utils:  4.2.2 
    @vue/component-compiler-utils:  3.1.1 
    @vue/eslint-config-airbnb: ^5.0.2 => 5.0.2 
    @vue/preload-webpack-plugin:  1.1.1 
    @vue/test-utils: ^1.0.0-beta.31 => 1.0.0-beta.31 
    @vue/web-component-wrapper:  1.2.0 
    bootstrap-vue: ^2.5.0 => 2.5.0 
    eslint-plugin-vue:  6.2.1 
    jest-serializer-vue:  2.0.2 
    portal-vue:  2.1.7 
    vue: ^2.6.11 => 2.6.11 
    vue-class-component:  7.2.3 
    vue-client-only:  2.0.0 
    vue-eslint-parser:  7.0.0 
    vue-functional-data-merge:  3.1.0 
    vue-hot-reload-api:  2.3.4 
    vue-i18n:  8.15.3 
    vue-i18n-extensions:  0.2.1 
    vue-jest:  3.0.5 
    vue-json-pretty: ^1.6.3 => 1.6.3 
    vue-loader:  15.9.0 
    vue-meta:  2.3.2 
    vue-no-ssr:  1.1.1 
    vue-property-decorator:  8.4.0 
    vue-router:  3.1.5 
    vue-server-renderer:  2.6.11 
    vue-slider-component: ^3.1.1 => 3.1.1 
    vue-star-rating: ^1.6.1 => 1.6.1 
    vue-style-loader:  4.1.2 
    vue-template-compiler:  2.6.11 
    vue-template-es2015-compiler:  1.9.1 
    vuedraggable: ^2.23.2 => 2.23.2 
    vuex: ^3.1.2 => 3.1.2 
  npmGlobalPackages:
    @vue/cli: 4.1.2

Steps to reproduce

Add some plugin to devDependencies (e.g. e2e-cypress, eslint, unit-jest, ...) Remove node_modules Run npm i --production Try to build something.. it fails on loading dev - even if you add it in --skip-plugins

What is expected?

build should skip devDependencies or --skip-plugins should skip loading this dependencies

What is actually happening?

build trying to load all dependencies (independently of skip-plugins)

carrey-k commented 2 years ago

Same issue:

devDependencies will be build into bundle file when using vue-cli-service build --target lib --name CustomComponent --filename custom-component lib/index.js