Git Product home page Git Product logo

Comments (11)

jackismissing avatar jackismissing commented on May 26, 2024 2

The dom-events module requires the use of a JSON loader for Webpack otherwise it won't work.

A solution for this :
npm install --save json-loader

Then in your webpack config file:
module: { loaders: [ { test: /\.json$/, loader: 'json' } ] }

Works like a charm for me now with Webpack. 🍺

from smooth-scrolling.

baptistebriel avatar baptistebriel commented on May 26, 2024 1

Not sure, because you're not using it as a module but a single file. That means the module has an issue, so I'm leaving this open until I find a solution.

from smooth-scrolling.

baptistebriel avatar baptistebriel commented on May 26, 2024

Hi,

Thanks for pointing this out!

I'm not using webpack, but did you tried looking at this issue or this blog post ?
Seems like we have to add a webpack.config.js — but I'm not completely sure.

Otherwise, can you try to edit the package.json file of the module and replace "main": "index.js" with "main": "smooth-scrolling.js"; relaunch the build task (using npm scripts, gulp, grunt or whatever you use) and see if you still have the error.

from smooth-scrolling.

jesperlandberg avatar jesperlandberg commented on May 26, 2024

hi,

Yeah I am using babel-presets/.babelrc (which they are recommending in the posts).

I tried doing what you said in the package.json and now I'm getting the following:
http://puu.sh/o5FRH/b1e2090bfa.png

Would be cool to get it working with webpack, if not I will need to jump back to my browserify/gulp setup=)

from smooth-scrolling.

baptistebriel avatar baptistebriel commented on May 26, 2024

Okay, then I guess we should keep index.js as the main entry point.

Did you tried the "configuring babel-loader" section of the blog post ?
I think you specially need a loaders key in the webpack.config.js along the .babelrc file:

loaders: [
  {
    loader: "babel-loader",

    include: [
      path.resolve(__dirname, "src"),
    ],

    test: /\.js?$/,

    query: {
      presets: ['es2015'],
    }
  }
]

This is basically what the error is about but maybe you'll need a couple of adjustments to make it work.

Also, do you have a "browserify" key in your project's package.json ? This is what I have on my projects. Maybe it can help!

from smooth-scrolling.

jesperlandberg avatar jesperlandberg commented on May 26, 2024

Hmm yes, I think I have my webpack.config.js configured similiar. Here is a pic of how my config looks:
http://puu.sh/o5RO7/2c3a06ed28.png

When I google this issue i mostly see the .babelrc and es2015 preset solution which I already have implemented, since I had a similiar issue earlier. Maybe I have to google harder=)

from smooth-scrolling.

baptistebriel avatar baptistebriel commented on May 26, 2024

I also had a hard time figuring out how to make babel work with my browserify setup when they updated to 6.0.. 😄

Maybe try to copy index.js (since you have a babel transform on your src folder) and just import directly the file, see if you still have the initial error? In that case I guess my transform presets loader query export thingy is not correctly set up! 😅

from smooth-scrolling.

jesperlandberg avatar jesperlandberg commented on May 26, 2024

I hate when configuring stuff takes longer than the actual work:P

I tried copying the index.js and installed the dependencies (dom-classes, dom-event etc) but getting errors, wasn't these hit by that whole NPM drama last week?

from smooth-scrolling.

baptistebriel avatar baptistebriel commented on May 26, 2024

Yeah indeed; I use the git repo for now, see package.json. Add theses lines and just re-run npm i

from smooth-scrolling.

jesperlandberg avatar jesperlandberg commented on May 26, 2024

Thanks, got it working now, guess that means the problem lays within my configuration then?:)

from smooth-scrolling.

baptistebriel avatar baptistebriel commented on May 26, 2024

Wow thanks a lot @jackismissing ! 😄 Can you maybe post a PR or the full webpack.config.js file so I can close this issue ?

🍻

from smooth-scrolling.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.