vue-cli-service build --mode produce different directory structure

Created on 1 Jul 2019  路  4Comments  路  Source: vuejs/vue-cli

Version

3.8.4

Reproduction link

https://codesandbox.io/s/vue-cli-n3let

Environment info

  System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
  Binaries:
    Node: 10.9.0 - ~/.nvm/versions/node/v10.9.0/bin/node
    Yarn: 1.12.1 - /usr/local/bin/yarn
    npm: 6.9.2 - ~/.nvm/versions/node/v10.9.0/bin/npm
  Browsers:
    Chrome: 75.0.3770.100
    Firefox: 67.0
    Safari: 12.1.1
  npmPackages:
    @casl/vue: ^0.5.1 => 0.5.1 
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0 
    @vue/babel-preset-app:  3.7.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.7.0 
    @vue/cli-plugin-babel: ^3.5.5 => 3.7.0 
    @vue/cli-plugin-e2e-nightwatch: ^3.4.0 => 3.7.0 
    @vue/cli-plugin-eslint: ^3.4.0 => 3.7.0 
    @vue/cli-plugin-pwa: ^3.4.0 => 3.7.0 
    @vue/cli-plugin-unit-jest: ^3.5.3 => 3.7.0 
    @vue/cli-service: ^3.5.3 => 3.7.0 
    @vue/cli-shared-utils:  3.7.0 
    @vue/component-compiler-utils:  2.6.0 
    @vue/eslint-config-prettier: ^4.0.1 => 4.0.1 
    @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 
    eslint-plugin-vue:  4.7.1 
    jest-serializer-vue:  2.0.2 
    vue: ^2.6.10 => 2.6.10 
    vue-cli-plugin-vuetify: ^0.5.0 => 0.5.0 
    vue-eslint-parser:  2.0.3 
    vue-google-signin-button: ^1.0.2 => 1.0.2 
    vue-hot-reload-api:  2.3.3 
    vue-i18n: ^8.10.0 => 8.11.2 
    vue-inheritance-loader: ^0.1.5 => 0.1.5 
    vue-jest:  3.0.4 
    vue-loader:  15.7.0 
    vue-observe-visibility:  0.4.3 
    vue-resize:  0.4.5 
    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 
    vue-virtual-scroll-list: ^1.3.3 => 1.3.7 
    vue-virtual-scroller: ^1.0.0-rc.2 => 1.0.0-rc.2 
    vue2-google-maps: ^0.10.2 => 0.10.6 
    vuetify: ^1.5.11 => 1.5.14 
    vuetify-loader: ^1.2.0 => 1.2.2 
    vuex: ^3.0.1 => 3.1.1 
    vuex-persist: ^2.0.0 => 2.0.0 
  npmGlobalPackages:
    @vue/cli: 3.8.4

Steps to reproduce

yarn build-dev

What is expected?

Producing dist folder with js folder inside of it.

What is actually happening?

Produced dist folder with .js files inside of it. (JS files are ending up in dist folder instead of dist/js.


Adding flag --mode with any values produces same result (i.e. vue-cli-service build --mode staging).

Most helpful comment

add 'NODE_ENV=production' to .env.staging

All 4 comments

add 'NODE_ENV=production' to .env.staging

Same problem again.

my vue.config

module.exports = {
  publicPath: '/',
  outputDir:'templates/',
  assetsDir: '../static/',
  transpileDependencies: [
    'vue-echarts',
    'resize-detector'
  ],
  configureWebpack: {
    optimization: {
      splitChunks: {
        chunks: 'all'
      }
    },
  },
}

running vue-cli-service build put files in the appropriate locations, but vue-cli-service build --mode development put all the files (the index.html and the js files inside the templates folder instead of static folder)

add 'NODE_ENV=production' to .env.staging

it doesn't work for library target, it still putting all the js file directly in the dist folder!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Benzenes picture Benzenes  路  3Comments

eladcandroid picture eladcandroid  路  3Comments

BusyHe picture BusyHe  路  3Comments

DrSensor picture DrSensor  路  3Comments

sanderswang picture sanderswang  路  3Comments