2021年3月17日星期三

Relative path doesn't work on liveserver but works on nodejs servers

I have a simple JS project. Front-end project.

I've installed a module X using this command:

npm i X  

I want to import that X. But to do that I need to specify the absolute path. But it's kinda killing

import X from '../node_modules/X/a/b/c/X.js';  

I am using live server extension on vs code. 127.0.0.1.

Is there any way that I can use relative paths ? Like this

import X from 'X';  
https://stackoverflow.com/questions/66683394/relative-path-doesnt-work-on-liveserver-but-works-on-nodejs-servers March 18, 2021 at 09:04AM

没有评论:

发表评论