aheissenberger / esbuild-plugin-text-replace Goto Github PK
View Code? Open in Web Editor NEWReplace content before bundling with support for Filefilter, Namespace, Regex and Functions.
License: BSD 2-Clause "Simplified" License
Replace content before bundling with support for Filefilter, Namespace, Regex and Functions.
License: BSD 2-Clause "Simplified" License
When using the pipe plugin, you are actually processing all the files, not only the ones that matches the include regex.
Maybe you can add a check here for transform.args.path
esbuild-plugin-text-replace/src/index.ts
Line 35 in fe807b4
It would like if the plugin can support esbuild-plugin-pipe. This will not change the existing functionality, but will add support for using text-replace within pipes (right now I'm first using this plugin then the pipes one).
Hi Andreas, thanks for the very helpful plugin.
I got an issue with the path pattern on Windows and Linux.
For instance, on windows the file path is using \
for directory and Linux is using /
, we can still use (\\|\/)
in the file pattern but it would be quite clumsy in the config. Is it possible to support both Windows and Linux paths without the hack? Thanks :D
textReplace({
include: /some\/nested\/directory\/file\.ts$/, // for linux
// include: /some\\nested\\directory\\file\.ts$/, // for windows
pattern: [
['__CONTENT_TO_BE_REPLACED__', 'replaced str'],
]
})
Hi, if I try to import/require version 1.1.2
I get this error.
$ node -e "require('esbuild-plugin-text-replace')"
internal/modules/cjs/loader.js:438
throw e;
^
Error [ERR_INVALID_PACKAGE_CONFIG]: Invalid package config /Users/riccardo.galli/some-project/node_modules/esbuild-plugin-text-replace/package.json. "exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.
at isConditionalExportsMainSugar (internal/modules/esm/resolve.js:449:13)
at packageExportsResolve (internal/modules/esm/resolve.js:470:7)
at resolveExports (internal/modules/cjs/loader.js:432:36)
at Function.Module._findPath (internal/modules/cjs/loader.js:472:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at [eval]:1:1
at Script.runInThisContext (vm.js:133:18) {
code: 'ERR_INVALID_PACKAGE_CONFIG'
}
The same code works just fine with version 1.1.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.