Skip to content

feat: Allow to import without dist#6385

Merged
susnux merged 1 commit into
masterfrom
feat/import-paths
Jan 15, 2025
Merged

feat: Allow to import without dist#6385
susnux merged 1 commit into
masterfrom
feat/import-paths

Conversation

@susnux

@susnux susnux commented Jan 14, 2025

Copy link
Copy Markdown
Contributor

The individual import path of components, composables, directives, and functions was changed.
The type of import is (e.g. components) is now lowercase and the dist will be omitted.
For example to import the NcButton component the path has changed:

  • from @nextcloud/vue/dist/Components/NcButton.js.
  • to @nextcloud/vue/components/NcButton.js

The old import paths are still valid, but deprecated and will be removed in version 9.

@susnux susnux added enhancement New feature or request 3. to review Waiting for reviews labels Jan 14, 2025
@susnux susnux requested a review from ShGKme January 14, 2025 17:35
@ShGKme

ShGKme commented Jan 14, 2025

Copy link
Copy Markdown
Contributor

Can/should we also remove .js suffix?

import NcButton from '@nextcloud/vue/components/NcButton'

@susnux

susnux commented Jan 14, 2025

Copy link
Copy Markdown
Contributor Author

Can/should we also remove .js suffix?

Yes we can, I have no strong opinion on this.
For real modules I prefer it without extension, but here 🤷
So yes if others also prefer it without extension.

@ShGKme

ShGKme commented Jan 14, 2025

Copy link
Copy Markdown
Contributor

For real modules I prefer it without extension, but here 🤷

That's why I don't like extensions here, they are different from real (even while it is valid)

@juliusknorr

Copy link
Copy Markdown
Contributor

Nice 👍

We should also update in the documentation

styleguide.config.js:			return `import ${name} from '@nextcloud/vue/dist/Components/${name}.js'`
docs/composables.md:import { useIsMobile } from '@nextcloud/vue/dist/composables/useIsMobile.js'
docs/composables.md:import { useIsMobile } from '@nextcloud/vue/dist/composables/useIsMobile.js'
docs/functions/usernameToColor.md:import usernameToColor from '@nextcloud/vue/dist/Functions/usernameToColor.js'
docs/functions/a11y.md:import { isA11yActivation } from '@nextcloud/vue/dist/Functions/a11y.js'
docs/directives.md:import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
docs/directives.md:import vTooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
docs/directives.md:import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
docs/composables/useHotKey.md:import { useHotKey } from '@nextcloud/vue/dist/Composables/useHotKey/index.js'
docs/directives/tooltip.md:import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
docs/directives/focus.md:import Focus from '@nextcloud/vue/dist/Directives/Focus.js'
docs/directives/linkify.md:import Linkify from '@nextcloud/vue/dist/Directives/Linkify.js'

@susnux susnux force-pushed the feat/import-paths branch from e5908c4 to a174ce8 Compare January 15, 2025 12:14
@susnux

susnux commented Jan 15, 2025

Copy link
Copy Markdown
Contributor Author

@juliusknorr

We should also update in the documentation

Done ✅

The individual import path of components, composables, directives, and functions was changed.
The type of import is (e.g. `components`) is now lowercase and the `dist` will be omitted.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux merged commit 25f0661 into master Jan 15, 2025
@susnux susnux deleted the feat/import-paths branch January 15, 2025 20:17
@susnux susnux added this to the 8.23.0 milestone Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants