3

In vue-cli-3.0, how to generate complete webpack.config.js. i have tried as the tutor but i failed with an error my trial code is just as below.

import a from "@vue/cli-service/webpack.config.js"
console.log(a)

and the error is as below,i don't know why it does not work.

"Invalid left-hand side in assignment at Object../node_modules/@vue/cli-service/lib/Service.js"

is this a bug?

1 Answer 1

4

You can't, the webpack configuration is composed dynamically by the vue cli and plugins.

If you need to tweak the config you can do so in the vue.config.js as described here

You can also use the vue inspect to see the resolved configuration.

Note the output is not a valid webpack config file, it's a serialized format only meant for inspection.

Sign up to request clarification or add additional context in comments.

6 Comments

Thank you very much,i've tried as you said and it worked.
But I still have a question. Do you know what does this mean link
And ,what does 'Note the output is not a valid webpack config file, it's a serialized format only meant for inspection.' mean ,then which part may be incorrect?
The output of "vue inspect" allows you to see what the final configuration options are, that way you can test if the vue.config.js made the changes you wnated. But you can't use it as a webpack.config.js in another project.
So,if i want to generate a webpack.config.js which can be used in another project, what should i do?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.