Does gulp have a function similar to webpack's alias?

such as configuration items like webpack

alias: {
    "@": resolve("src")
}

can gulp automatically change the"@ "symbol into a relative path to reference?

such as import a from"@ / utils/index"
automatically becomes import a from".. / utils/index"?


first of all, there are some deviations in the author's understanding of gulp and webpack.

  • gulp is a task runner, that can define multiple tasks in gulpfile.js, and webpack packaging js operations can be defined in gulpfile.js as a task. Gulp itself does not handle references and escapes of js.
  • webpack is a tool for packaging front-end resources, such as js,css, images, and so on. There are many scenarios combined with npm scripts.

therefore, the title owner should first confirm which tool is used in gulpfile for js escape and packaging, and then find out whether the corresponding tool provides alias-like configuration items. For example, babel implements the alias of a module with babel-plugin-module-resolver .

Menu