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.

Export from "app" must be a function that returns an HTML string

See original GitHub issue

Here’s a repo that reproduces the issue: https://github.com/sidjain26/static-react-issue

Note: This is using webpack v2.1, babel v6, react v15, react-router v2.4

Run

npm i
npm run build

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
ahoerethcommented, Aug 18, 2016

I saw your comment and pull request. In order to leverage tree shaking one needs to disable module syntax transformation.

webpack 2 natively supports ES6 import and export statements. webpack 2 leverages the static structure of the ES6 modules to perform tree shaking.

More info: https://github.com/gajus/babel-preset-es2015-webpack

1reaction
f0rr0commented, Aug 23, 2016

@ahoereth Oh nice, I missed your comment while going through this. Also, that is exactly what I did in the original PR but I modified it to just check for default, since if __esModule is own property then, so will be default. So didn’t make sense to check for both.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Export from "app" must be a function that returns an HTML ...
I am trying to use this library in combination with react router. my webpack plugins has: entry: { app: ['src/app.js'] }, plugins: [...
Read more >
Laravel Export : Function name must be a string - Stack Overflow
Having a problem with this code <?php namespace App\Exports ...
Read more >
export - JavaScript - MDN Web Docs
The export declaration is used to export values from a JavaScript module. Exported values can then be imported into other programs with the ......
Read more >
module.exports – How to Export in Node.js and JavaScript
In this article, I will show you how to share functions and values by exporting and importing modules in Node.js.
Read more >
Understanding Modules and Import and Export Statements in ...
As the importance of JavaScript in web development grows, there is a bigger need to use third-party code for common tasks, to break...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found