Git Product home page Git Product logo

test-webpack's Introduction

test-webpack

todo

  • inject css and js into html
  • hot reload when modifying
  • add babel and eslint

note

  • 为什么loader使用的位置叫模块?
    • 因为在webpack中,不同类型的文件都是一个模块
  • css-loader 仅是处理css模块,没有作任何输出
    • 若需要输出成文件,可使用插件输出成file
  • 使用插件将 css 和 js 注入 自定义的 html 模板中,当然也可以直接生成 html
  • webpack hot module 只能支持 JS 部分的修改,如果需要支持样式文件( css / less / sass ... )的 hot reload ,就不能使用 extract-text-webpack-plugin 将样式文件剥离出去,否则无法监听修改、实时刷新。从这里出发考虑分别对开发环境和生产环境使用不同的 webpack 配置文件。
  • live-reloading vs HMR
    • live-reloading 是指当代码更新后,浏览器会实时刷新
    • HMR 是更高级的功能,当代码更新后,浏览器可以不刷新便更新内容,内部使用了 websocket 通讯协议。
  • 为什么我修改了 css 但是没有 hot-reload
    • 我使用了 extract-text-webpack-plugin 插件把 css 单独抽出来,但是这种处理方式并不能触发 HMR。HMR 的官网上说,它只会在有 HMR 代码的模块中发生作用,比如用 style-loader 处理的 css。所以,dev 下,只能用 style-loader。

test-webpack's People

Watchers

James Cloos avatar Wang Xiaolu avatar

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.