question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with build with webpack2.1.0-beta

See original GitHub issue

It could be also webpack related issue, just wanted to make you aware about the problem

Version

1.0.10

Reproduction

in webpackbin it works - http://www.webpackbin.com/4yqYB5WlM but I’m not able to choose version of webpack

Steps to reproduce

git clone https://github.com/mayacode/react-redux-starter/tree/styled-components-problem npm install webpack

I have webpack@^2.1.0-beta.25 and webpack-dev-serve@^2.1.0-beta.10 installed globally.

Expected Behavior

const Title = styled.h1 should work

Actual Behavior

open index.html in console you’ll see Uncaught TypeError: _styledComponents2.default.h1 is not a function(…)

but if you change const Title = styled.h1 to const Title = styled.default.h1 everything works

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mxstbrcommented, Nov 1, 2016

This is actually a problem with your setup. You’re telling both Babel and webpack to transpile ES2015 modules, which is why you end up with .default.default. /cc @TheLarkinn, maybe he has an idea how to avoid this?

The fix is to disable babel’s modules transpiling in your webpack.config.js:

      {
        loader: 'babel',
        query: {
          presets: [['es2015', { modules: false }], 'react', 'stage-0']
        }
      }

(notice the modules: false)

screen shot 2016-11-01 at 16 49 12

0reactions
rohmanhmcommented, Dec 23, 2016

removed .babelrc file, and used this config

options: {
  presets: [['es2015', { modules: false }], 'react', 'stage-0']
}

Work perfectly without an alias to styled-components Thanks!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not working with webpack2.1.0.beta22 and further #33 - GitHub
i have troubles with resolve-url-loader (1.6.0) and webpack2.1.0.beta25 my webpack.config.js: const sourceMapQueryStr = (config.enabled.
Read more >
Webpack Dev Server 2.1.0-beta.02 fails to load modules on ...
I'm setting up a new project with webpack2.1.0-beta.22 and web-pack-dev-server2.1.0-beta.2 . Now, I've set up a webpack build configs a few ...
Read more >
Webpack v2.1.0-beta.23 issues with fix - sage - Roots Discourse
I've just been installing Trellis and ran into issues with Webpack v2.1.0-beta.23. It seems the one of the Webpack maintainer's is aware.
Read more >
How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >
karma-webpack | Yarn - Package Manager
The first preproccessor triggers the build of all the bundles/chunks and all following files just ... webpack: add support for webpack2.1.0-beta (bdd8c80) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found