Skip to content

Commit

Permalink
feat: Add webpack 5 support
Browse files Browse the repository at this point in the history
Co-authored-by: Putzi San <putzisan@putzisan.de>
Co-authored-by: Øyvind Saltvik <oyvind.saltvik@gmail.com>
  • Loading branch information
3 people committed Apr 9, 2020
1 parent c5a5882 commit 39c38a4
Show file tree
Hide file tree
Showing 76 changed files with 3,334 additions and 452 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Expand Up @@ -3,9 +3,17 @@ node_js:
- stable
- lts/*
- 6.9
env:
- WEBPACK_CORE=4
- WEBPACK_CORE=beta
jobs:
exclude:
- node_js: 6.9
env: WEBPACK_CORE=beta
before_install:
- stty columns 120
install:
- travis_retry npm install --ignore-scripts
- travis_retry npm install "webpack@$WEBPACK_CORE" --ignore-scripts
script:
- travis_retry npm test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions examples/appcache/dist/webpack-5/bundle.js
@@ -0,0 +1,47 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 636:
/***/ (() => {

// extracted by mini-css-extract-plugin

/***/ })

/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /************************************************************************/
(() => {
__webpack_require__(636);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);

})();

/******/ })()
;
1 change: 1 addition & 0 deletions examples/appcache/dist/webpack-5/index.html
@@ -0,0 +1 @@
<!doctype html><html lang="en" manifest="manifest.appcache"><head><meta charset="utf-8"><title>Example template</title><meta name="viewport" content="width=device-width,initial-scale=1"><link href="styles.css" rel="stylesheet"></head><body><img src="0714810ae3fb211173e2964249507195.png"><script src="bundle.js"></script></body></html>
9 changes: 9 additions & 0 deletions examples/appcache/dist/webpack-5/manifest.appcache
@@ -0,0 +1,9 @@
CACHE MANIFEST
# f509954c60c2fd048c91

0714810ae3fb211173e2964249507195.png
styles.css
bundle.js

NETWORK:
*
3 changes: 3 additions & 0 deletions examples/appcache/dist/webpack-5/styles.css
@@ -0,0 +1,3 @@
body {
background: snow;
}
2 changes: 1 addition & 1 deletion examples/appcache/webpack.config.js
Expand Up @@ -16,7 +16,7 @@ module.exports = {
rules: [
{ test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader'] },
{ test: /\.png$/, loader: 'file-loader' },
{ test: /\.html$/, loader: 'html-loader?-removeOptionalTags' }
{ test: /\.html$/, loader: 'html-loader', options: { removeOptionalTags: false } }
]
},
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion examples/build-examples.js
Expand Up @@ -20,7 +20,7 @@ examples.forEach(function (exampleName) {
var configFile = path.join(examplePath, 'webpack.config.js');

var config = require(configFile);
if (webpackMajorVersion === '4') {
if (Number(webpackMajorVersion) >= 4) {
config.plugins.unshift(new webpack.LoaderOptionsPlugin({
options: {
context: process.cwd() // or the same value as `context`
Expand Down
40 changes: 40 additions & 0 deletions examples/chunk-optimization/dist/webpack-5/73.js
@@ -0,0 +1,40 @@
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[73],{

/***/ 173:
/***/ ((module, exports, __webpack_require__) => {

exports = module.exports = __webpack_require__(609)(false);
// Module
exports.push([module.id, "body {\n background: snow;\n}", ""]);



/***/ }),

/***/ 73:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {


var content = __webpack_require__(173);

if(typeof content === 'string') content = [[module.id, content, '']];

var transform;
var insertInto;



var options = {"hmr":true}

options.transform = transform
options.insertInto = undefined;

var update = __webpack_require__(379)(content, options);

if(content.locals) module.exports = content.locals;

if(false) {}

/***/ })

}]);

0 comments on commit 39c38a4

Please sign in to comment.