What is this @ in the require? can someone describe?
let bla = require('@/api/blabla');
what is the "@" symbol means in this path?
You are probably talking about the resolve.alias
in Webpack or subpath patterns in Node.js? They often resolve to @
for their src Directory (for example in Vue.js this is used often but is not limited to vue.js).
For example if @
resolves to the src folder in this structure:
my-app/
├─ src/
│ ├─ foo/
│ │ ├─ bar.js
│ ├─ index.js
├─ package.json
Those imports from index.js will be the same:
@/index.js
and ./index.js
@/foo/bar.js
and ./foo/bar.js
and from bar.js those will be the same:
@/index.js
and ../index.js
@/foo/bar.js
and ./bar.js
So these operators can help you to navigate in extremely nested directories to find your files.
It depends upon the package name. Some packages like @fastify/helmet will be written as require('@fastify/helmet')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.