entwicklerstube / babel-plugin-root-import

Add the opportunity to import modules by the root path
https://npmjs.com/babel-plugin-root-import
MIT License
1.18k stars 76 forks source link

Hello, please ask a question, using linux path configuration, will it parse correctly on windows? #156

Open qingaoti opened 5 months ago

qingaoti commented 5 months ago

as follows:

using linux path configuration [ 'babel-plugin-root-import', { rootPathSuffix : "./node/", rootPathPrefix : '@/', }, ],

The two file locations are as follows: F:\work\code\在水医方\zk-server\node\__test__\simple-text-diff-test.js F:\work\code\在水医方\zk-server\node\config\testImport.js

Run in windows environment image

code: image

be commented out: import testimport2 from '@/config/testimport'; console.log('testimport2:', testimport2);

[simple-text-diff-test.js:23] Current directory: F:\work\code\在水医方\zk-server\node\__test__ [simple-text-diff-test.js:33] Error resolving "@/config/testimport": Error: Cannot find module './node/config/testimport' [simple-text-diff-test.js:37] Resolved path using path.resolve for "@/config/testimport": F:\work\code\在水医方\zk-server\node\__test__\@\config\testimport