Comments (8)
Thanks for the help @JordanMachado & @noeldelgado!
I just switched to ES2015 exports.
npm i [email protected] --save
...should now work with webpack! (🤞)
from smooth-scrolling.
Have you got the ify
loader for your node_modules ?
from smooth-scrolling.
I think it has to do with mixing CommonJS and ES2015 module imports/exports.
Choosing either direction did the trick for me (both using rollup
and webpack
v2).
CommonJS
const classes = require('dom-classes')
...
class Smooth {
...
module.exports = window.Smooth = Smooth
ES2015
import classes from 'dom-classes'
...
export default class Smooth {
...
window.Smooth = Smooth
Not sure about browserify
though.
Hope it helps.
from smooth-scrolling.
Hi @magicspon,
Indeed it's an issue because of the way we export/import the module. It's working with browserify and I don't use webpack so I'm not sure which syntax to use... It's a big complex mess.
Instead of import
, could you maybe use require
?
require('smooth-scrolling').default
Or maybe switch the module.exports
to export default Smooth
in the node_modules
folder, just to see if this fixes the issue?
Also, @jesperlandberg and @jackismissing had a similar issue. I think they fixed it with a JSON loader (don't ask me why!), see issue #24. Hope it helps.
Sorry about that!
from smooth-scrolling.
hello, thanks for getting back to me.
I'm using webpack 2 which handles json files by default.
require('smooth-scrolling').default
throws some other flavour of error
Uncaught TypeError: Super expression must either be null or a function, not undefined
and changing the modules export to export default Smooth
causes another different error, something to do with the new key word (even though I am using new)...
how very bizarre.
not to worry, if I copy the source file into one of my own project files it works. something is going wrong en route from node_modules to my project. Muchos odd.
Not to worry... if I have time at the weekend I might take a fork and have a deep look.
Thanks again
from smooth-scrolling.
Yes, indeed. Seems like @jesperlandberg had to do the same and copy the smooth-scrolling
folder into the project directory.
Let me know if you find anything, and do not hesitate to post a PR if you managed to make it work using webpack!
from smooth-scrolling.
What I did for the project I used it on was to just copy the non built file (index.js) into my project directory. However since I will soon use this (great) module again it would be nice to do it the "proper" way, so if anyone comes up with a solution, let us know=)
from smooth-scrolling.
Turbo belting... top works boys and girls!
from smooth-scrolling.
Related Issues (20)
- Horizontal scroll demos not working HOT 2
- (Parallax demo) vs-scrollbar-smooth and vs-scrollbar-parallax got different scroll position after smooth.scrollTo
- Build version including parallax HOT 4
- Empty space at page bottom when transitioning page HOT 2
- Has the latest version been published to NPM? HOT 2
- scrollTo() after resize HOT 2
- Cannot find module 'babelify'
- Next.js Compatibility HOT 2
- Immediately set the scroll position HOT 2
- How to implement with GSAP ScrollTrigger HOT 17
- Scroll event on container not working
- Hiding the scroll thumb when content doesn't extend beyond viewport. HOT 4
- Scrolling section responsive
- Uncaught TypeError: Class constructor Smooth cannot be invoked without 'new' HOT 1
- Error when building HOT 1
- StickySidebar with Smooth-Scroll
- Use native touch scrolling? HOT 6
- Smooth.resize() when using native gives error. HOT 1
- Custom easing function? HOT 1
- Horizontal scroll demo with both Y and X scrolling HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smooth-scrolling.