Webpack - how can I identify and exclude some package from rendering?

asiniy

I'm using react-stdio server to render react.js on the server side.

Webpack rendered javascript file has these lines:

 /***/
 /* 49 */
 /***/ function(module, exports, __webpack_require__)
 »·/* WEBPACK VAR INJECTION */(function(global) {/* global window */             
 »·'use strict';                                                                 

 »·module.exports = __webpack_require__(50)(global || window || this);           

 »·/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))  

 /***/ },                                                                        
 /* 50 */                                                                        
 /***/ function(module, exports) { 

The problem is that react-stdio dislikes the window variable: react-stdio returns to me ReferenceError: window is not defined. So, questions:

  1. How can I understand which dependency is marked as #49?
  2. How can I eliminate this window variable from the build?
Ori Drori

Try to add target: 'node' to your webpack.config. According to the webpack docs:

Target: "node" Compile for usage in a node.js-like environment (use require to load chunks)

module.exports = {
  entry: './src/main.js',
  target: 'node',
  output: {
    path: path.join(__dirname, 'build'),
    filename: 'backend.js'
  }
}

If this doesn't work, try this tutorial - Backend Apps with Webpack (the example was taken from it).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

In Yii2, how can I exclude layout from rendering in a view file?

From Dev

When rendering json in rails, how can I exclude an entry from an included association?

From Dev

How can I exclude some packages (within a JAR) from a Maven dependency?

From Dev

How can I Identify which package classes are in use in my program?

From Dev

Can I exclude an exported package from a Java module?

From Dev

How can I exclude some attributes with JAXB to be convertet to xml

From Dev

How can I exclude some pattern using regex

From Dev

How do I exclude a package from an imported JAR for a project in Eclipse?

From Dev

How can I add the bootstrap-material-design package into webpack?

From Dev

How can I identify partitions of an Android device from the shell?

From Dev

How can i identify a turtle from a list by its position in Python?

From Dev

How can I identify this element

From Dev

How do I exclude some I/O variables I don't need from being stored in memory?

From Java

How to exclude directory from getting bundled by Webpack?

From Dev

Rubocop: how can I exclude a filename pattern from a metric?

From Dev

How can I exclude from Gradle dependency lists after the fact?

From Java

How can I exclude directories from grep -R?

From Java

How can I exclude all "permission denied" messages from "find"?

From Dev

How can I exclude a plugin from grails default gsp encoding?

From Dev

How can I exclude a folder from an Artifact Path on TeamCity?

From Dev

How can i exclude .less files from publish?

From Dev

How can I exclude urls from Sitemap Generator

From Dev

How can I exclude a directory from ls command

From Dev

How can I exclude classes from a Grails 3 plugin

From Dev

How can I exclude a file from deploy in gcloud?

From Dev

How can I exclude pull requests from git mirror clone

From Dev

How can I exclude proftp authentication failure messages from logwatch?

From Dev

How can I exclude a plugin from grails default gsp encoding?

From Dev

How can I exclude classes from a Grails 3 plugin

Related Related

  1. 1

    In Yii2, how can I exclude layout from rendering in a view file?

  2. 2

    When rendering json in rails, how can I exclude an entry from an included association?

  3. 3

    How can I exclude some packages (within a JAR) from a Maven dependency?

  4. 4

    How can I Identify which package classes are in use in my program?

  5. 5

    Can I exclude an exported package from a Java module?

  6. 6

    How can I exclude some attributes with JAXB to be convertet to xml

  7. 7

    How can I exclude some pattern using regex

  8. 8

    How do I exclude a package from an imported JAR for a project in Eclipse?

  9. 9

    How can I add the bootstrap-material-design package into webpack?

  10. 10

    How can I identify partitions of an Android device from the shell?

  11. 11

    How can i identify a turtle from a list by its position in Python?

  12. 12

    How can I identify this element

  13. 13

    How do I exclude some I/O variables I don't need from being stored in memory?

  14. 14

    How to exclude directory from getting bundled by Webpack?

  15. 15

    Rubocop: how can I exclude a filename pattern from a metric?

  16. 16

    How can I exclude from Gradle dependency lists after the fact?

  17. 17

    How can I exclude directories from grep -R?

  18. 18

    How can I exclude all "permission denied" messages from "find"?

  19. 19

    How can I exclude a plugin from grails default gsp encoding?

  20. 20

    How can I exclude a folder from an Artifact Path on TeamCity?

  21. 21

    How can i exclude .less files from publish?

  22. 22

    How can I exclude urls from Sitemap Generator

  23. 23

    How can I exclude a directory from ls command

  24. 24

    How can I exclude classes from a Grails 3 plugin

  25. 25

    How can I exclude a file from deploy in gcloud?

  26. 26

    How can I exclude pull requests from git mirror clone

  27. 27

    How can I exclude proftp authentication failure messages from logwatch?

  28. 28

    How can I exclude a plugin from grails default gsp encoding?

  29. 29

    How can I exclude classes from a Grails 3 plugin

HotTag

Archive