-
My project layout looks like this:
Using Parcel, I need to specify each alias explicitly such as: "alias": {
"@modules/lazyload": "./src/scripts/modules/lazyload/index.js",
"@utilities/selectors": "./src/scripts/utilities/selectors/index.js",
"@utilities/helpers": "./src/scripts/utilities/helpers/index.js"
}, In other Bundler, I just need to specify part of alias (only top level modules) : Snowpack and Webpack is simmiliar: alias: {
'@modules': './src/scripts/modules',
'@utilities': './src/scripts/utilities',
}, esbuild: // Redirect all paths starting with "@modules/" to "src/scripts/modules"
build.onResolve({ filter: /^@modules\// }, (args) => {
// get such `@modules/mobile-nav` without the `@module` part
let moduleName = args.path.split("/")[1]
return { path: path.resolve("src/scripts/modules", moduleName, "index.js") }
})
build.onResolve({ filter: /^@utilities\// }, (args) => {
let moduleName = args.path.split("/")[1]
return { path: path.resolve("src/scripts/utilities", moduleName, "index.js") }
}) I can't do that in Parcel, I need to specify each of the aliases to a concrete file. Is this expected?
|
Beta Was this translation helpful? Give feedback.
Answered by
mischnic
Jun 2, 2021
Replies: 1 comment 1 reply
-
Can you open an issue for this? We should support that if Webpack also supports it. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
azzamsa
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you open an issue for this? We should support that if Webpack also supports it.