Giter Club home page Giter Club logo

Comments (14)

sebmck avatar sebmck commented on May 11, 2024

You most likely have a 4.x babel-runtime. Please remove your node_modules folder and npm install again.

from babel-loader.

euforic avatar euforic commented on May 11, 2024

@sebmck tried that already and also did a npm cache clean

from babel-loader.

sebmck avatar sebmck commented on May 11, 2024

Not sure what's causing this then:

$ node
> require("babel-runtime/core-js")["default"].Object.defineProperty
[Function: defineProperty]

from babel-loader.

euforic avatar euforic commented on May 11, 2024

@sebmck I think the problem might be a compatibility issue with iojs. Switched to node 0.12.x and it works now.

from babel-loader.

sebmck avatar sebmck commented on May 11, 2024

@euforic

$ iojs
> require("babel-runtime/core-js")["default"].Object.defineProperty
[Function: defineProperty]

from babel-loader.

euforic avatar euforic commented on May 11, 2024

@sebmck never mind It's still happening in both. I still get the error with the simple example below, but if I remove the constructor function the error is gone.

  • babel-loader: 5.0.0
  • babel-core: 5.1.10
  • babel-runtime: 5.1.10
  • react: 0.13.1

index.js

import React from 'react';

class MyComponent extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return <div> test </div>;
  }
}
React.render(<MyComponent/>, document.getElementById('main'));

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Bug Example</title>
    <meta name="description" content="">
    <script src='//cdnjs.cloudflare.com/ajax/libs/react/0.13.1/react.js'></script>
  </head>
  <body>
    <div id="main"></div>
    <script type="text/javascript" src="/bundle.js"></script>
  </body>
</html>

webpack.config.js

var webpack = require('webpack');

module.exports = {
  entry: {
    app: './index.js'
  },
  output: {
    path: './build',
    filename: 'bundle.js',
    publicPath: '/'
  },
  devtool: 'inline-source-maps',
  module: {
    loaders: [
      { test: /\.(js|jsx)$/, loader: 'babel?stage=0&optional=runtime', exclude:['node_modules'] }
    ]
  },
  externals: {
    react: 'React',
  },
  resolve: {
    extensions: ['', '.js', '.jsx']
  }
};

from babel-loader.

euforic avatar euforic commented on May 11, 2024

here is a jsfiddle to demo the error https://jsfiddle.net/euforic/5vjqabv3/474/

from babel-loader.

sebmck avatar sebmck commented on May 11, 2024

Can you verify that you're using the latest babel-runtime please. cc @zloirock

from babel-loader.

zloirock avatar zloirock commented on May 11, 2024

@sebmck emm? In last example I don't see core-js, only helpers.

from babel-loader.

sebmck avatar sebmck commented on May 11, 2024

@zloirock Look at the jsfiddle, the error is being thrown on the line module.exports = __webpack_require__(10).core.Object.keys;.

from babel-loader.

zloirock avatar zloirock commented on May 11, 2024

Interesting. I don't test it with webpack. I will investigate the problem in the evening.

from babel-loader.

zloirock avatar zloirock commented on May 11, 2024

Looks like bug it config. Webpack run runtime transformer on core-js files.

from babel-loader.

sebmck avatar sebmck commented on May 11, 2024

Try changing your exclude filter to /node_modules/.

from babel-loader.

euforic avatar euforic commented on May 11, 2024

@sebmck yep that fixes it. Thanks for all the help!

from babel-loader.

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.