There are cases when I need to use another cli (in my case are dotnet
and start-storybook
) for running some of my project. To run it properly, final webpack.config.js (sum of = vue.config.js + default vue config + all config of vue-cli-plugin-*) need to be acessed so it can be merged with another default webpack config (storybook) or integrate webpack hot-reload and its config into another server side framework.
I can only think 2 solution for this:
chainableConfig
So user can do something like:
const { chainableConfig } = require('@vue/cli')
const mergeWebpack = require('webpack-merge')
// this is storybook way for extending config
module.exports = (baseConfig, env, defaultConfig) => mergeWebpack(chainableConfig.toConfig(), defaultConfig)
However, the problem with this approach is I can't merge it with another server side framework that use another programing language (in my case are ASP.NET Core using webpack-aspnet-middleware)
vue eject
Implement eject command to output the final config into a file. This way I can point exactly where webpack.config.js
are in my ASP.NET startup module. However, to make it safe, every time server-side cli run/start/build then vue eject
need to be executed first.
I'd +1 for this also, would like to avoid the kind of lock-in and troubles you get trying to make changes to a project that's been set up using something like laravel mix.
You can already access it as node_modules/@vue/cli-service/webpack.config.js
. This file dynamically resolves to the same config used in your actual project.
We use the webpack config file to create aliases to our modules/folders.
How can we do it now? I think, if we do it in the node_modules, everytime we clone the project we will need to do it again
Most helpful comment
You can already access it as
node_modules/@vue/cli-service/webpack.config.js
. This file dynamically resolves to the same config used in your actual project.