javascript - Why do some paths in webpack config use path.resolve?
滿天的星座
滿天的星座 2017-05-18 10:46:05
0
4
1412

I looked at the webpack.config.js of some projects, and they all use path.resolve()

I don’t understand why this is the case. Why not use relative paths directly?

Solution.

滿天的星座
滿天的星座

reply all(4)
某草草

Portability, because a configuration file may be divided into many parts and then included. And most of the time, each part may be in other directories for neat structure.

刘奇

@justjavac I have the same question, can you give me a more detailed answer on the first floor, or give me a reference link

刘奇

If you use a relative path, you will be in trouble if you change the file location

左手右手慢动作

Platform-independent, flexible, and convenient. The path.resolve() method is an API provided by node and is easy to use.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template