zoukankan      html  css  js  c++  java
  • [Webpack 2] Expose modules to dependencies with Webpack

    When you have a dependency that has dependencies on global variables (like jQuery or lodash) or assumes that this is bound to window, you can use the imports-loaderto provide those dependencies explicitly.

    In case there is one dependency that we use need lodash, but didn't includes lodash as dependency. 

    One way to solve the problem is that we can include lodash as denpedency in our application. 

    Another way is expose lodash to that library, to do that, you need to Install:

    npm i -D imports-loader

    Add to webpack config:

            {
              test: require.resolve('./src/js/non_node_modules/sweet-lodash-mixins'),
              loader: 'imports?_=lodash'
            }
  • 相关阅读:
    反射:框架设计的灵魂
    Junit测试
    XML笔记
    map 的用法
    opencv总结1
    光源
    镜面反射
    openGL纹理对象
    GPU入门
    动态规划1
  • 原文地址:https://www.cnblogs.com/Answer1215/p/5622054.html
Copyright © 2011-2022 走看看