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 "svelte" entry point to package.json #94

Merged
merged 1 commit into from
Nov 8, 2021
Merged

Add "svelte" entry point to package.json #94

merged 1 commit into from
Nov 8, 2021

Conversation

cbenz
Copy link
Contributor

@cbenz cbenz commented Oct 24, 2021

Adding the "svelte" property to package.json is recommended by:

Without it, when using SvelteKit, and doing the following import:

import { portal } from "svelte-portal"

I get this error:

/home/cbenz/Dev/tests/my-project/node_modules/svelte-portal/src/Portal.svelte:1
<script context="module">
^

SyntaxError: Unexpected token '<'
    at wrapSafe (internal/modules/cjs/loader.js:1001:16)
    at Module._compile (internal/modules/cjs/loader.js:1049:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.<anonymous> (/home/cbenz/Dev/tests/my-project/node_modules/svelte-portal/src/main.cjs.js:1:18)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)

Adding the "svelte" property to package.json solves the error.

Without it, when using SvelteKit, and doing the following import:

```javascript
import { portal } from "svelte-portal"
```

I get this error:

```
/home/cbenz/Dev/tests/my-project/node_modules/svelte-portal/src/Portal.svelte:1
<script context="module">
^

SyntaxError: Unexpected token '<'
    at wrapSafe (internal/modules/cjs/loader.js:1001:16)
    at Module._compile (internal/modules/cjs/loader.js:1049:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.<anonymous> (/home/cbenz/Dev/tests/my-project/node_modules/svelte-portal/src/main.cjs.js:1:18)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
```
@romkor romkor merged commit 12d750f into romkor:master Nov 8, 2021
@romkor
Copy link
Owner

romkor commented Nov 8, 2021

Hi @cbenz, thank you for pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants