use the file namespace for file entry points

This commit is contained in:
Evan Wallace
2021-03-28 11:07:53 -07:00
parent 1face3ea42
commit 4774f8b883
3 changed files with 67 additions and 22 deletions

View File

@@ -863,6 +863,25 @@ let pluginTests = {
assert.strictEqual(result.outputFiles[3].text, `// virtual-ns:input a/b/c.d.e\nconsole.log("input a/b/c.d.e");\n`)
},
async entryPointFileNamespace({ esbuild, testDir }) {
const input = path.join(testDir, 'in.js')
let worked = false
await writeFileAsync(input, 'stuff')
await esbuild.build({
entryPoints: [input],
write: false,
plugins: [{
name: 'name',
setup(build) {
build.onResolve({ filter: /.*/, namespace: 'file' }, () => {
worked = true
})
},
}],
})
assert(worked)
},
async stdinImporter({ esbuild, testDir }) {
const output = path.join(testDir, 'out.js')
await esbuild.build({