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

warnings on build #53

Closed
flipkickmedia opened this issue Jan 30, 2022 · 10 comments
Closed

warnings on build #53

flipkickmedia opened this issue Jan 30, 2022 · 10 comments

Comments

@flipkickmedia
Copy link

flipkickmedia commented Jan 30, 2022

Some warnings during a build with webpack 5

WARNING in ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/components/Mesh.svelte
Module Warning (from ./node_modules/.pnpm/[email protected][email protected]/node_modules/svelte-loader/index.js):
Mesh_1 has unused export property 'onClick'. If it is for external reference only, please consider using `export const onClick` (341:11)
339: }
340: // ------- Interaction --------------
341: export let onClick = undefined;
                ^
342: export let onPointerUp = undefined;
343: export let onPointerDown = undefined;
 @ ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/svelthree.js 3:0-58 3:0-58
 @ ./src/components/dynamic/3d.svelte 16:0-26:19 38:25-42 47:20-32 51:24-40 55:12-16 139:13-18 155:21-34 212:14-20 260:24-41 261:24-44
 @ ./src/components/ lazy ^\.\/.*$ chunkName: [request] namespace object ./dynamic/3d.svelte ./dynamic/3d
 @ ./src/lib/dynamicImports.ts 36:16-39:50
 @ ./src/main.ts 2:0-52 4:10-22

WARNING in ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/components/Mesh.svelte
Module Warning (from ./node_modules/.pnpm/[email protected][email protected]/node_modules/svelte-loader/index.js):
Mesh_1 has unused export property 'onPointerDown'. If it is for external reference only, please consider using `export const onPointerDown` (343:11)
341: export let onClick = undefined;
342: export let onPointerUp = undefined;
343: export let onPointerDown = undefined;
                ^
344: export let onPointerOver = undefined;
345: export let onPointerOut = undefined;
 @ ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/svelthree.js 3:0-58 3:0-58
 @ ./src/components/dynamic/3d.svelte 16:0-26:19 38:25-42 47:20-32 51:24-40 55:12-16 139:13-18 155:21-34 212:14-20 260:24-41 261:24-44
 @ ./src/components/ lazy ^\.\/.*$ chunkName: [request] namespace object ./dynamic/3d.svelte ./dynamic/3d
 @ ./src/lib/dynamicImports.ts 36:16-39:50
 @ ./src/main.ts 2:0-52 4:10-22

WARNING in ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/components/Mesh.svelte
Module Warning (from ./node_modules/.pnpm/[email protected][email protected]/node_modules/svelte-loader/index.js):
Mesh_1 has unused export property 'onPointerEnter'. If it is for external reference only, please consider using `export const onPointerEnter` (346:11)
344: export let onPointerOver = undefined;
345: export let onPointerOut = undefined;
346: export let onPointerEnter = undefined;
                ^
347: export let onPointerLeave = undefined;
348: export let onPointerMove = undefined;
 @ ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/svelthree.js 3:0-58 3:0-58
 @ ./src/components/dynamic/3d.svelte 16:0-26:19 38:25-42 47:20-32 51:24-40 55:12-16 139:13-18 155:21-34 212:14-20 260:24-41 261:24-44
 @ ./src/components/ lazy ^\.\/.*$ chunkName: [request] namespace object ./dynamic/3d.svelte ./dynamic/3d
 @ ./src/lib/dynamicImports.ts 36:16-39:50
 @ ./src/main.ts 2:0-52 4:10-22

WARNING in ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/components/Mesh.svelte
Module Warning (from ./node_modules/.pnpm/[email protected][email protected]/node_modules/svelte-loader/index.js):
Mesh_1 has unused export property 'onPointerLeave'. If it is for external reference only, please consider using `export const onPointerLeave` (347:11)
345: export let onPointerOut = undefined;
346: export let onPointerEnter = undefined;
347: export let onPointerLeave = undefined;
                ^
348: export let onPointerMove = undefined;
349: </script>
 @ ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/svelthree.js 3:0-58 3:0-58
 @ ./src/components/dynamic/3d.svelte 16:0-26:19 38:25-42 47:20-32 51:24-40 55:12-16 139:13-18 155:21-34 212:14-20 260:24-41 261:24-44
 @ ./src/components/ lazy ^\.\/.*$ chunkName: [request] namespace object ./dynamic/3d.svelte ./dynamic/3d
 @ ./src/lib/dynamicImports.ts 36:16-39:50
 @ ./src/main.ts 2:0-52 4:10-22

WARNING in ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/components/Mesh.svelte
Module Warning (from ./node_modules/.pnpm/[email protected][email protected]/node_modules/svelte-loader/index.js):
Mesh_1 has unused export property 'onPointerMove'. If it is for external reference only, please consider using `export const onPointerMove` (348:11)
346: export let onPointerEnter = undefined;
347: export let onPointerLeave = undefined;
348: export let onPointerMove = undefined;
                ^
349: </script>
350: 
 @ ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/svelthree.js 3:0-58 3:0-58
 @ ./src/components/dynamic/3d.svelte 16:0-26:19 38:25-42 47:20-32 51:24-40 55:12-16 139:13-18 155:21-34 212:14-20 260:24-41 261:24-44
 @ ./src/components/ lazy ^\.\/.*$ chunkName: [request] namespace object ./dynamic/3d.svelte ./dynamic/3d
 @ ./src/lib/dynamicImports.ts 36:16-39:50
 @ ./src/main.ts 2:0-52 4:10-22

WARNING in ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/components/Mesh.svelte
Module Warning (from ./node_modules/.pnpm/[email protected][email protected]/node_modules/svelte-loader/index.js):
Mesh_1 has unused export property 'onPointerOut'. If it is for external reference only, please consider using `export const onPointerOut` (345:11)
343: export let onPointerDown = undefined;
344: export let onPointerOver = undefined;
345: export let onPointerOut = undefined;

WARNING in ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/components/Mesh.svelte
Module Warning (from ./node_modules/.pnpm/[email protected][email protected]/node_modules/svelte-loader/index.js):
Mesh_1 has unused export property 'onPointerUp'. If it is for external reference only, please consider using `export const onPointerUp` (342:11)
340: // ------- Interaction --------------
341: export let onClick = undefined;
342: export let onPointerUp = undefined;
                ^
343: export let onPointerDown = undefined;
344: export let onPointerOver = undefined;
 @ ./node_modules/.pnpm/[email protected]/node_modules/svelthree/src/svelthree.js 3:0-58 3:0-58
 @ ./src/components/dynamic/3d.svelte 16:0-26:19 38:25-42 47:20-32 51:24-40 55:12-16 139:13-18 155:21-34 212:14-20 260:24-41 261:24-44
 @ ./src/components/ lazy ^\.\/.*$ chunkName: [request] namespace object ./dynamic/3d.svelte ./dynamic/3d
 @ ./src/lib/dynamicImports.ts 36:16-39:50
 @ ./src/main.ts 2:0-52 4:10-22

WARNING in vendors-node_modules_pnpm_svelthree_0_119_0-5_node_modules_svelthree_src_svelthree_js.bundle.js is 5.53 MB, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit.

8 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.67.0 compiled with 9 warnings in 14740 ms

package.json extract

    "svelte": "^3.46.3",
    "svelte-check": "^2.4.0",
    "svelte-hero-icons": "^3.2.0-beta.0",
    "svelte-loader": "^3.1.2",
    "svelte-preprocess": "^4.10.2",
    "svelte-router-spa": "^6.0.3",
    "svelthree": "^0.119.0-5",
@vatro
Copy link
Owner

vatro commented Feb 1, 2022

yeah, I know, they're always there, I've learned to live with it ;) ... Do you have any idea how to get rid of them? Probably disabling that specific type of warning 🤔 ... those props are NOT 'for external reference only', so they can't be a const.

EDIT: I now remember being at this point several times in the past, those warnings can be disabled, but I've decided not to: sometimes (rare) they do warn me about props which could really be a const, so 🤷‍♂️.

--compiler-warnings "unused-export-let:error" should do the trick
see: sveltejs/language-tools#650 (comment)

@vatro vatro added the not a bug label Feb 1, 2022
@vatro vatro self-assigned this Feb 1, 2022
@vatro vatro closed this as completed Feb 1, 2022
@flipkickmedia
Copy link
Author

yeah best not ignore these warnings - and I can give you a PR if you like

@flipkickmedia
Copy link
Author

    // ------- Interaction --------------

    export let onClick: (e?: CustomEvent) => void;
    export let onPointerUp: (e?: CustomEvent) => void;
    export let onPointerDown: (e?: CustomEvent) => void;
    export let onPointerOver: (e?: CustomEvent) => void;
    export let onPointerOut: (e?: CustomEvent) => void;
    export let onPointerEnter: (e?: CustomEvent) => void;
    export let onPointerLeave: (e?: CustomEvent) => void;
    export let onPointerMove: (e?: CustomEvent) => void;

    onClick = null
    onPointerUp = null
    onPointerDown = null
    onPointerOver = null
    onPointerOut = null
    onPointerEnter = null
    onPointerLeave = null
    onPointerMove = null

solves it. without testing this properly

@vatro
Copy link
Owner

vatro commented Feb 1, 2022

yeah best not ignore these warnings - and I can give you a PR if you like

thanks, but there's no need for that, this is already fixed / changed in newer versions see:

export let onClick: MeshInteractionHandler = undefined
export let onPointerUp: MeshInteractionHandler = undefined
export let onPointerDown: MeshInteractionHandler = undefined
export let onPointerOver: MeshInteractionHandler = undefined
export let onPointerOut: MeshInteractionHandler = undefined
export let onPointerEnter: MeshInteractionHandler = undefined
export let onPointerLeave: MeshInteractionHandler = undefined
export let onPointerMove: MeshInteractionHandler = undefined

The currently published version is super-old and was changed a lot, try the newest one, see: https://github.com/vatro/svelthree/tags

Please keep in mind that newer versions of svelthree use svelte-accmod, means you'll have to patch original Svelte (>= 3.44.2) via npx svelte-accmod-patch. I'm currently nailing down installation instructions for 1.0.0 (pre-release) versions and I tend to release 1.0.0-next.x, so you could take a look at https://github.com/vatro/svelthree later today or tomorrow for new installation details. Thanks!

flipkickmedia added a commit to flipkickmedia/svelthree that referenced this issue Feb 1, 2022
@flipkickmedia
Copy link
Author

The assignment separate from the definition squashes the error.

@vatro
Copy link
Owner

vatro commented Feb 2, 2022

The assignment separate from the definition squashes the error.

Thanks, I'll take a look at it again, they're annoying and I would like to get rid of them too. What I don't like is the extra code "for nothing" 😕 ... hm... maybe there IS a more elegant solution? 🤔

@vatro vatro reopened this Feb 2, 2022
@vatro vatro added the Svelte label Feb 2, 2022
@vatro
Copy link
Owner

vatro commented Feb 2, 2022

Hm... it seems the "x was created without expected prop y" warning has been removed?! see REPL
That warning is / was the reason for all the = undefined in the first place. If this is now (since when?) not necessary, then separate assignments would make more sense + they would suppress the "If it is for external reference only, please consider using export const"

@vatro
Copy link
Owner

vatro commented Feb 4, 2022

"x was created without expected prop y" warning has been removed?!

nope, it's still there, but only in the console <Child> was created without expected prop 'something' no warning-bar, means:

<!-- Child.svelte  -->

<svelte:options accessors />

<script>
// setting initial value of exported vars to some value or 'undefined' / 'null'
// removes the 'x was created without expected prop y' warning
export let foo = undefined
export let bar = null
export let baz = 1
let boo
	
// using exported vars (somehow) removes the 'has unused export property ...' warning
/*
foo = undefined
bar = null
baz = 1
*/
if(!foo && !bar) {
  boo = baz + 1
  console.log(boo) // 2
}
	
</script>

possible solutions / syntax to get rid of the unused-export-let:error:

<script>
  export let foobar = undefined
  foobar = undefined
</script>

or ...

<script>
  export let foobar = undefined
  foobar = foobar
</script>

or just ...

<script>
  export let foobar = undefined
  foobar
</script>

... or use the accessor in a meaningful way inside component code.

see also: sveltejs/svelte#5892

The interaction accessors (handlers) are currently being checked by the SvelthreeInteraction component like e.g.:

typeof parent.onClick === "function"

means we're not passing them to the SvelthreeInteraction component directly, maybe we should just do that? This would also remove the warning and would (currently) be my preferred solution. 🤔

  • Check if there are any caveats concerning component updates with the solutions above (svelte-accmod)!

@vatro
Copy link
Owner

vatro commented Feb 8, 2022

@flipkickmedia

Hi Tom!
Thanks for bringing this up 👍, I'm definitely going to do something about it (see comment above)!
Would you like to submit a pull request?

@vatro
Copy link
Owner

vatro commented Feb 10, 2022

@flipkickmedia I'm going to fix / close this now. Please feel free to contribute in future! 👍

@vatro vatro closed this as completed in 356f6f0 Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants