JSPM

webpack-dev-server-sio

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q32727F
  • License MIT

webpack dev server with hot reload and ie8 compability

Package Exports

  • webpack-dev-server-sio

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (webpack-dev-server-sio) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

webpack-dev-server-sio

webpack dev server with reload and ie8 compability

This tool is for solving problems when using below packages:

  • webpack-dev-server
  • webpack-hot-middleware

which would use some uncompatible features of es6 like setter/getter, that won't work under ie8.

Requirement

  • webpack 4.x
  • node >= 8.9

Notice

  • Webpack config is basically the same as webpack 4
  • The compiled result should be compatible with ie8. This tool is just for hot reload.

Usage

install

npm install --save-dev webpack-dev-server-sio
# or
yarn add --dev webpack-dev-server-sio

script

in package.json

{
    "script": {
        "dev:sio": "webpack-dev-server-sio --config=config/webpack.conf.js"
    }
}

in config

// config/webpack.config.js
// 除了 devServe 之外的配置与正常 webpack4 配置没有区别

module.exports = {
    ...
    devServer: {
        // port for the server in localhost,http://localhost:port
        port: 9090,
        // the path of packaged resource
        contentBase: 'C://path/to/pack/resource',
        // pxoxy config is the same as webpack-dev-server
        proxy: {
            '/re': {
                target: 'http://localhost:7001',
                changeOrigin: true,
                pathRewrite: {
                    '^/re': '/re',
                },
            },
        },
        // see connect-history-api-fallback
        historyApiFallback: {
            rewrites: [
                {
                    from: /\/home/, to: '/home.html/',
                },
            ],
        },
        // set headers of server responses
        headers: [
            'set-cookie': 'token=token; path=/',
        ],
    }
}