how to just concat some module

i write lib.js:

 import jQuery from 'jquery'
 import React from 'react'
 import ReactDOM from 'react-dom'

i just want to concat all third-party libs.

But webpack wraps some code,like

(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
    module.exports = factory();
else if(typeof define === 'function' && define.amd)
    define([], factory);
else {
    var a = factory();
    for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/    // The module cache
/******/    var installedModules = {};
/******/
/******/    // The require function
/******/    function __webpack_require__(moduleId) { //...

how to remove the wrapped code?

Author: Fantashit

2 thoughts on “how to just concat some module

  1. I have the same problem, is this solved in any way? I am moving from gulp to webpack and had a general.js file with a bunch of utility global functions. Some of them were simply attached to inputs via jQuery, like:
    $(‘#someinput’).keyup(function(){ mycustomglobalfunction();});
    None of these are working anymore, because webpack wraps and hides them.
    How do I fix this in the “webpack way” without refactoring the whole .js shit?

  2. In Webpack 4 I was finally able to achieve this by adding this to my configuration:

    module.exports = {
      // the rest of my config...
      optimization: {
        splitChunks: {
          chunks: 'all'
        }
      }
    }

Comments are closed.