Search code examples
vue.jswebpackvue-cli-3

Vue - Compile other folder outside of /src in Vue.js project


I have a regular Vue.js project (created using v3.0.3) that uses WebSockets. Also in the project root is the /server folder which has the Node.js code that houses the multi-player aspect and socket code.

However, since the folder /server is independent of the /src folder from the Vue.js project, how do I make use of the Vue CLI webpack config and add babel compiling (using Webpack) to appropriately compile both the /src

enter image description here

https://cli.vuejs.org/guide/webpack.html#simple-configuration


Solution

  • I was able to import babel-cli and just compile/run like so:

    ./node_modules/.bin/nodemon --exec babel-node --presets env,stage-2 server.js
    

    and it worked.