-
Notifications
You must be signed in to change notification settings - Fork 160
Use file extensions explicitly #432
Description
Describe the bug
I am having issues being able to package individual components up due to the following error:
ERROR in ./node_modules/@vscode/webview-ui-toolkit/dist/button/index.js 6:0-57
Module not found: Error: Can't resolve './button.styles' in '/Users/christianbromann/Sites/Stateful/projects/vscode-runme/node_modules/@vscode/webview-ui-toolkit/dist/button'
Did you mean 'button.styles.js'?
BREAKING CHANGE: The request './button.styles' failed to resolve only because it was resolved as fully specified
It seems this project recently migrated to ESM (which I would consider being recognised as major version bump) and files in dist
still have no explicit file extension, e.g.
import { buttonStyles as styles } from './button.styles';
Maybe there is just a misunderstanding how these components are supposed to be consumed. I currently just bundle them into my webview code and import them like:
import '@vscode/webview-ui-toolkit/dist/button/index.js'
as I don't need all of the components.
To reproduce
Checkout this branch: runmedev/vscode-runme#79 and try to build the project.
Expected behavior
I am able to import individual components.
Current behavior
It throws an error.
Screenshots
Desktop (please complete the following information):
- OS Version: [e.g.
macOS 11.3.1
] - Toolkit Version: [e.g.
v0.8.0
]
Additional context
I will rollback for now so nothing urgent here but would be great if:
-
all file imports could have explicit extensions
-
every component could be exported through
package.json
so I could do something likeimport Button from '@vscode/webview-ui-toolkit/button'