Comments (8)
@ws456999 can you try this?
foo/index.tsx
export default class Foo {
render() {
return <div className="hehe">hello there!!!</div>
}
}
index.js
import Foo from './foo/index'
console.log(Foo)
from rollup-plugin-esbuild.
@aelbore ,
foo/index.tsx
export default class Foo {
render() {
return <div className="hehe">hello there!!!</div>
}
}
index.js
import Foo from './foo'
console.log(Foo)
works in rollup with rollup-plugin-typescript
my project have too much such case,
Locate modules using the Node resolution algorithm in webpack,how can i use same rule with some config or plugins?
from rollup-plugin-esbuild.
@ws456999 the thing is if you have foo/index.tsx and foo.tsx exist
from rollup-plugin-esbuild.
@aelbore It's two question,
-
esbuild don't resolve module like Node resolution algorithm;
-
the priority of location modules
I only care about the first question,Do you have any ideas?
from rollup-plugin-esbuild.
@aelbore
not sure if this is work around or this is the fixed
if foo.tsx
exist load foo.tsx
even if foo/index.tsx
exist
else load the foo/index.tsx
and yes esbuild doesnt resolve like Node resolution
const coreModule = (resolved: string) => {
if (existsSync(resolved) && statSync(resolved).isDirectory()) {
for (const loader of loaders) {
const file = join(resolved, `index.${loader}`)
if (existsSync(file)) {
return file
}
}
}
return null
}
const loadFile = (resolved: string) => {
for (const loader of loaders) {
const file = `${resolved}.${loader}`
if (existsSync(file)) {
return file
}
}
return null
}
let file = loadFile(resolved)
if (file) return file
if (!file) {
file = coreModule(resolved)
if (file) return file
}
from rollup-plugin-esbuild.
@aelbore
it works for me! thanks a lot.
from rollup-plugin-esbuild.
looking forward to your next version
from rollup-plugin-esbuild.
from rollup-plugin-esbuild.
Related Issues (20)
- 🐛 filenames like `component.utils.ts` are not resolved properly and breaks build HOT 1
- Support reading jsx from tsconfig.json HOT 1
- update mangleCache in renderChunk HOT 2
- Invalid option in transform() call: "jsxDev" HOT 1
- optimizeDeps option ignores subpaths of provided package
- support `jsxImportSource` option HOT 3
- Support rollup@v3 HOT 2
- tsconfig is support object HOT 1
- Patch version v4.10.2 has breaking changes HOT 3
- "==" operator will also match 0 HOT 2
- Typescript Reflection system HOT 1
- TypeError: esbuild is not a function HOT 13
- No clean way to disable exclude HOT 1
- cant support tsconfig.compilerOptions.paths? HOT 1
- How to compile to ES5? HOT 2
- Error in a project using decorators if esbuild version is >= 0.18.0 HOT 4
- ReferenceError: __name is not defined HOT 1
- browser: true ignored when used with @rollup/plugin-node-resolve HOT 1
- Plugin does not resolve "extends" field for tsconfig HOT 4
- Vite Plugin type error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rollup-plugin-esbuild.