Closed jonathanmelville closed 3 years ago
If you are using Nuxt, you have to transpile the package:
in nuxt.config.js
:
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
transpile: ['seamless-scroll-polyfill'],
},
IntelliJ still can't resolve it though, but it does seem to work:
This library has two entries, the main
entry with umd
format and the module
entry with esm
.
Most packagers use the main
entry, but generally there is an option that can be tweaked. For example, webpack uses resolve.mainFields
to change the order of which entry to use.
I'm not familiar with Nuxt, its default mainField
may not be main
.
But there should be a similar option that can change the mainField
.
If you cannot use esm
format, try umd
format.
IntelliJ's issue seems to be another issue about types which I have no clue.
Yes I don't understand how to import either.
import { windowScroll } from 'seamless-scroll-polyfill';
Thanks @magic-akari for the reply and for maintaining the lib! Very helpful to have this for Safari.
@9mm This does actually work exactly as described in the docs, but it's possible you might have to transpile this dependency (with say Babel) to get the import to work properly.
Ok, for vue-cli
and Vue 3 this goes in vue.config.js
:
transpileDependencies: ['seamless-scroll-polyfill'],
Ever since the recent update, it is unclear how to import and use this lib.
This doesn't work:
You will get something like this
Cannot resolve symbol 'polyfill'