Declaration files cannot be found when consuming nested input files
See original GitHub issueHi, my rollup config looks like this:
import typescript from 'rollup-plugin-typescript2'
import rebasePlugin from 'rollup-plugin-rebase'
import pkg from './package.json'
export default {
// Entry files
input: {
index: 'src/index.ts',
Button: 'src/Button/index.ts',
Spinner: 'src/Spinner/index.ts',
Icon: 'src/Icon/index.ts',
Note: 'src/Note/index.ts',
Logo: 'src/Logo/index.ts',
Card: 'src/Card/index.ts',
Image: 'src/Image/index.ts',
Modal: 'src/Modal/index.ts',
Drawer: 'src/Drawer/index.ts',
Tabs: 'src/Tabs/index.ts',
Accordion: 'src/Accordion/index.ts',
List: 'src/List/index.ts',
Form: 'src/Form/index.ts',
Transition: 'src/Transition/index.ts',
Divider: 'src/Divider/index.ts',
NewsletterForm: 'src/NewsletterForm/index.ts',
// Layout
Grid: 'src/Layout/Grid/index.ts',
Container: 'src/Layout/Container/index.ts',
// FormControls
TextInput: 'src/FormControls/TextInput/index.ts',
TextArea: 'src/FormControls/TextArea/index.ts',
Select: 'src/FormControls/Select/index.ts',
Stepper: 'src/FormControls/Stepper/index.ts',
Checkbox: 'src/FormControls/Checkbox/index.ts',
Radio: 'src/FormControls/Radio/index.ts',
Toggle: 'src/FormControls/Toggle/index.ts',
// Type
P: 'src/Type/P/index.ts',
H1: 'src/Type/H1/index.ts',
H2: 'src/Type/H2/index.ts',
H3: 'src/Type/H3/index.ts',
H4: 'src/Type/H4/index.ts',
Ol: 'src/Type/Ol/index.ts',
Ul: 'src/Type/Ul/index.ts',
Code: 'src/Type/Code/index.ts',
},
// Output as pure es modules into a lib folder, should probably add more output types at some point
output: [
{
dir: 'lib',
format: 'es',
},
],
// Exclude any dependancies in the bundle, these will auto install when the users adds this lib
// Exclude any peerDepenacies, the consumer should install these themselves
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
plugins: [
// Handle typescript
typescript({
typescript: require('typescript'),
exclude: ['**/*.stories.tsx', 'node_modules'],
}),
// Handle all assets
rebasePlugin(),
],
}
When consuming my package, importing components with the following syntax works fine:
import { Button } from '@mycomponents'
I have added multiple inputs for people to consume just the component they want. I have noticed that when consuming, this is working for all of my components except the nested ones. (eg all the inputs live in a folder called FormControls)
Works: import { Button } from '@mycomponents/lib/Button'
Doesn’t work: import { TextInput } from '@mycomponents/lib/TextInput'
Is there a recommended way to do this?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Could not find a declaration file for module - Stack Overflow
I have burnt on this when I try to consume a package with "main": "index" in systemjs . – unional. Mar 22, 2017...
Read more >@rollup/plugin-typescript - npm
file Rollup configuration, and TypeScript to output declaration files, users may encounter a situation where the declarations are nested ...
Read more >input can't find file (nested directory structure) - TeX
I'd like to input it into content/chapter2.tex . However when I use \input{./figures/LaTeX/figure} it tells me it can't find the file even ...
Read more >Documentation - Namespaces - TypeScript
Even though the files are separate, they can each contribute to the same namespace and can be consumed as if they were all...
Read more >Learn Modules In Azure Bicep - Basics To Advanced, How It ...
Any Bicep file can be consumed as a module; In other words, module is about how you consume a Bicep file, not how...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Dropping them into a flat file structure is not feasible because they might have name conflicts, also typescript generates internal imports based on file structure…
You could merge them into a single file. There are some tools that can take d.ts and merge them, or you could run tsc explicitly and use bundling options.
Is there anyway to dump all of the d.ts files into one dir instead of recreating the project folder structure?