Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add root-level import #936

Merged
merged 4 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions react/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*
!*.js
!.gitignore
!package.json
!outline
Expand Down
16 changes: 16 additions & 0 deletions react/index.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// The only reason this file exists is to appease Vite's optimizeDeps feature which requires a root-level import.

export default new Proxy(
{},
{
get: (_, property) => {
if (property === '__esModule') {
return {}
}

throw new Error(
`Importing from \`@heroicons/react\` directly is not supported. Please import from either \`@heroicons/react/20/solid\`, \`@heroicons/react/24/solid\`, or \`@heroicons/react/24/outline\` instead.`
)
},
}
)
16 changes: 16 additions & 0 deletions react/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// The only reason this file exists is to appease Vite's optimizeDeps feature which requires a root-level import.

module.exports = new Proxy(
{},
{
get: (_, property) => {
if (property === '__esModule') {
return {}
}

throw new Error(
`Importing from \`@heroicons/react\` directly is not supported. Please import from either \`@heroicons/react/20/solid\`, \`@heroicons/react/24/solid\`, or \`@heroicons/react/24/outline\` instead.`
)
},
}
)
6 changes: 5 additions & 1 deletion react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
],
"sideEffects": false,
"exports": {
".": {
"import": "./index.esm.js",
"require": "./index.js"
},
"./package.json": {
"default": "./package.json"
},
Expand Down Expand Up @@ -114,4 +118,4 @@
"peerDependencies": {
"react": ">= 16"
}
}
}
1 change: 1 addition & 0 deletions vue/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*
!*.js
!.gitignore
!package.json
16 changes: 16 additions & 0 deletions vue/index.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// The only reason this file exists is to appease Vite's optimizeDeps feature which requires a root-level import.

export default new Proxy(
{},
{
get: (_, property) => {
if (property === '__esModule') {
return {}
}

throw new Error(
`Importing from \`@heroicons/vue\` directly is not supported. Please import from either \`@heroicons/vue/20/solid\`, \`@heroicons/vue/24/solid\`, or \`@heroicons/vue/24/outline\` instead.`
)
},
}
)
16 changes: 16 additions & 0 deletions vue/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// The only reason this file exists is to appease Vite's optimizeDeps feature which requires a root-level import.

module.exports = new Proxy(
{},
{
get: (_, property) => {
if (property === '__esModule') {
return {}
}

throw new Error(
`Importing from \`@heroicons/vue\` directly is not supported. Please import from either \`@heroicons/vue/20/solid\`, \`@heroicons/vue/24/solid\`, or \`@heroicons/vue/24/outline\` instead.`
)
},
}
)
6 changes: 5 additions & 1 deletion vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
],
"sideEffects": false,
"exports": {
".": {
"import": "./index.esm.js",
"require": "./index.js"
},
"./package.json": {
"default": "./package.json"
},
Expand Down Expand Up @@ -114,4 +118,4 @@
"peerDependencies": {
"vue": ">= 3"
}
}
}