esbuild-plugin-path-alias
Advanced tools
Comparing version 1.0.2 to 1.0.3
15
index.js
@@ -75,9 +75,14 @@ const fs = require('fs'); | ||
const { logLevel } = build.initialOptions; | ||
const outputLogs = logLevel === 'debug' || logLevel === 'verbose'; | ||
const main = (k, args) => { | ||
const targetPath = config[k].replace(/\/$/, ''); | ||
const patchedPath = patchExtension(args.path | ||
.replace(new RegExp(`^${k}\\/`), targetPath + '/') | ||
.replace(new RegExp(`^${k}$`), targetPath)); | ||
console.log( | ||
`${new Date().toLocaleTimeString()} [esbuild-plugin-path-alias] `, | ||
const patchedPath = patchExtension( | ||
args.path | ||
.replace(new RegExp(`^${k}\\/`), targetPath + '/') | ||
.replace(new RegExp(`^${k}$`), targetPath) | ||
); | ||
outputLogs && console.log( | ||
`${new Date().toLocaleTimeString()} [plugin-path-alias] `, | ||
args.path, | ||
@@ -84,0 +89,0 @@ '=>', |
{ | ||
"name": "esbuild-plugin-path-alias", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A esbuild plugin to support path alias like `resolve.alias` in webpack config.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
4473
134