GithubHelp home page GithubHelp logo

exercise12's People

Watchers

 avatar  avatar  avatar  avatar

exercise12's Issues

webpack.config.js的一些问题

module.exports = {
  entry: './src/index.js',
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'index.js'
  },
  module: {
    rules: [
      {
        test: /\.js/,
        use: [
          'define-loader'
        ]
      }
    ]
  },
  resolveLoader: {
    modules: [
      'node_modules',
      path.resolve(__dirname, 'loader')
    ]
  }
}

我理一下顺序~还有点提问;

理解 : entry入口进来后~进module 里面找后缀是正则匹配js结尾的文件用use里面的装载机(是叫装载机吧?)编译一下,然后通过output输出到指定的目录并且定义一下输出后的文件名字~~

问题 : 这use里面的define-loader这个他通过什么路径找到这个的呢??是插件吗??问题我这个不是放再node-modules文件夹里面的,他怎么找的,还有下面的resolveLoader这个是什么啊???这个是说如果你再node_modules文件夹里面没找到就去loader文件夹里面找吗???

后来我百度了一下:use里面的基本都是插件去module里面找的~,然后如果是自定义的那就用resolveLoader属性封装一下,让他到你指定的目录下去找是吧....归纳的有点乱,百度上也没具体说明好像,
老师看看是这么理解吗??

为什么Loader会执行两次

比如课上的define-loader.js
在global.js会执行一次,然后入口文件index.js执行一次。
红框是index.js,蓝框是global.js。

qq 20180305221542

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.