diff --git a/README.md b/README.md index 47cd9922..8342f8a2 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ yarn add esbuild-loader --dev ## Usage +### Transpiling In `webpack.config.js`: ```js @@ -24,19 +25,65 @@ module.exports = { test: /\.[jt]sx?$/, loader: 'esbuild-loader', options: { - // All options are optional target: 'es2015', // default, or 'es20XX', 'esnext' - jsxFactory: 'React.createElement', - jsxFragment: 'React.Fragment', - sourceMap: false // Enable sourcemap }, }, + { + test: /\.tsx$/, + loader: 'esbuild-loader', + options: { + loader: 'tsx', + target: 'es2015', + }, + }, + ], + }, + plugins: [ + new ESBuildPlugin() + ] +} +``` + +### Minifying + +In `webpack.config.js`: + +```js +const { ESBuildPlugin, ESBuildMinifyPlugin } = require('esbuild-loader') + +module.exports = { + optimization: { + minimize: true, + minimizer: [ + new ESBuildMinifyPlugin() ], }, - plugins: [new ESBuildPlugin()], + + plugins: [ + new ESBuildPlugin() + ], } ``` + +## Options + +### Loader +The loader supports options from [esbuild](https://github.com/evanw/esbuild#command-line-usage). +- `target` `` (`es2015`) - Environment target (e.g. es2017, chrome80, esnext) +- `loader` `` (`js`) - Which loader to use to handle file. Possible values: `js, jsx, ts, tsx, json, text, base64, file, dataurl, binary` +- `jsxFactory` `` - What to use instead of React.createElement +- `jsxFragment` `` - What to use instead of React.Fragment +- Enable source-maps via [`devtool`](https://webpack.js.org/configuration/devtool/) + +### MinifyPlugin +- `minify` `` (`true`) - Sets all `--minify-*` flags +- `minifyWhitespace` `` - Remove whitespace +- `minifyIdentifiers` `` - Shorten identifiers +- `minifySyntax` `` - Use equivalent but shorter syntax +- `sourcemap` `` (defaults to Webpack `devtool`)- Whether to emit sourcemaps + + ## License MIT © [EGOIST (Kevin Titor)](https://github.com/sponsors/egoist) diff --git a/package.json b/package.json index 1934dc6e..f0a45789 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "author": "EGOIST", "license": "MIT", "scripts": { - "test": "jest --env node" + "test": "jest --env node", + "lint": "prettier --write src test/*.js" }, "files": [ "src" @@ -13,12 +14,15 @@ "devDependencies": { "@types/jest": "^25.2.1", "jest": "^26.0.1", + "memfs": "^3.2.0", "prettier": "^2.0.5", "typescript": "^3.8.3", + "unionfs": "^4.4.0", "webpack": "^4.43.0" }, "dependencies": { "esbuild": "^0.5.16", - "loader-utils": "^2.0.0" + "loader-utils": "^2.0.0", + "webpack-sources": "^1.4.3" } } diff --git a/src/index.js b/src/index.js index 18021b90..c782554e 100644 --- a/src/index.js +++ b/src/index.js @@ -1,70 +1,3 @@ -const path = require('path') -const esbuild = require('esbuild') -const { getOptions } = require('loader-utils') - -const getLoader = (ext) => { - if (ext === '.json') { - return 'json' - } - return 'tsx' -} - -module.exports = async function (source) { - const done = this.async() - const options = getOptions(this) - /** @type {import('esbuild').Service} */ - const service = this._compiler.$esbuildService - - if (!service) { - return done( - new Error( - `[esbuild-loader] You need to add ESBuildPlugin to your webpack config first` - ) - ) - } - - try { - const ext = path.extname(this.resourcePath) - - const result = await service.transform(source, { - target: options.target || 'es2015', - loader: getLoader(ext), - jsxFactory: options.jsxFactory, - jsxFragment: options.jsxFragment, - sourcemap: options.sourceMap, - }) - done(null, result.js, result.jsSourceMap) - } catch (err) { - done(err) - } -} - -module.exports.ESBuildPlugin = class ESBuildPlugin { - /** - * @param {import('webpack').Compiler} compiler - */ - apply(compiler) { - let watching = false - - const startService = async () => { - if (!compiler.$esbuildService) { - compiler.$esbuildService = await esbuild.startService() - } - } - - compiler.hooks.run.tapPromise('esbuild', async () => { - await startService() - }) - compiler.hooks.watchRun.tapPromise('esbuild', async () => { - watching = true - await startService() - }) - - compiler.hooks.done.tap('esbuild', () => { - if (!watching && compiler.$esbuildService) { - compiler.$esbuildService.stop() - compiler.$esbuildService = undefined - } - }) - } -} +module.exports = require('./loader') +module.exports.ESBuildPlugin = require('./plugin') +module.exports.ESBuildMinifyPlugin = require('./minify-plugin') diff --git a/src/loader.js b/src/loader.js new file mode 100644 index 00000000..d74ee176 --- /dev/null +++ b/src/loader.js @@ -0,0 +1,33 @@ +const path = require('path') +const { getOptions } = require('loader-utils') + +async function ESBuildLoader(source) { + const done = this.async() + const options = getOptions(this) + /** @type {import('esbuild').Service} */ + const service = this._compiler.$esbuildService + + if (!service) { + return done( + new Error( + `[esbuild-loader] You need to add ESBuildPlugin to your webpack config first` + ) + ) + } + + try { + const result = await service.transform(source, { + target: options.target || 'es2015', + loader: options.loader || 'js', + jsxFactory: options.jsxFactory, + jsxFragment: options.jsxFragment, + sourcemap: this.sourceMap, + sourcefile: this.resourcePath, + }) + done(null, result.js, result.jsSourceMap) + } catch (err) { + done(err) + } +} + +module.exports = ESBuildLoader diff --git a/src/minify-plugin.js b/src/minify-plugin.js new file mode 100644 index 00000000..7916f1e8 --- /dev/null +++ b/src/minify-plugin.js @@ -0,0 +1,81 @@ +const { RawSource, SourceMapSource } = require('webpack-sources') + +const isJsFile = /\.js$/i +const pluginName = 'esbuild-minify' + +class ESBuildMinifyPlugin { + constructor(options) { + this.options = { ...options } + + const hasMinify = Object.keys(this.options).some((k) => + k.startsWith('minify') + ) + if (!hasMinify) { + this.options.minify = true + } + } + + /** + * @param {import('webpack').Compiler} compiler + */ + apply(compiler) { + const { options } = this + + compiler.hooks.compilation.tap(pluginName, (compilation) => { + const service = compiler.$esbuildService + + if (!service) { + throw new Error( + `[esbuild-loader] You need to add ESBuildPlugin to your webpack config first` + ) + } + + const { devtool } = compiler.options + const sourcemap = + options.sourcemap !== undefined + ? options.sourcemap + : devtool && devtool.includes('source-map') + + compilation.hooks.optimizeChunkAssets.tapPromise( + pluginName, + async (chunks) => { + const transforms = chunks.flatMap((chunk) => { + return chunk.files + .filter((file) => isJsFile.test(file)) + .map(async (file) => { + const assetSource = compilation.assets[file] + const { source, map } = assetSource.sourceAndMap() + + const result = await service.transform(source, { + ...options, + sourcemap, + sourcefile: file, + }) + + compilation.updateAsset(file, () => { + if (sourcemap) { + return new SourceMapSource( + result.js || '', + file, + result.jsSourceMap, + source, + map, + true + ) + } else { + return new RawSource(result.js || '') + } + }) + }) + }) + + if (transforms.length) { + await Promise.all(transforms) + } + } + ) + }) + } +} + +module.exports = ESBuildMinifyPlugin diff --git a/src/plugin.js b/src/plugin.js new file mode 100644 index 00000000..2ed40a02 --- /dev/null +++ b/src/plugin.js @@ -0,0 +1,34 @@ +const esbuild = require('esbuild') + +class ESBuildPlugin { + /** + * @param {import('webpack').Compiler} compiler + */ + apply(compiler) { + let watching = false + + const startService = async () => { + if (!compiler.$esbuildService) { + compiler.$esbuildService = await esbuild.startService() + } + } + + compiler.hooks.run.tapPromise('esbuild', async () => { + await startService() + }) + + compiler.hooks.watchRun.tapPromise('esbuild', async () => { + watching = true + await startService() + }) + + compiler.hooks.done.tap('esbuild', () => { + if (!watching && compiler.$esbuildService) { + compiler.$esbuildService.stop() + compiler.$esbuildService = undefined + } + }) + } +} + +module.exports = ESBuildPlugin diff --git a/test/__snapshots__/index.test.js.snap b/test/__snapshots__/index.test.js.snap deleted file mode 100644 index a5a3af71..00000000 --- a/test/__snapshots__/index.test.js.snap +++ /dev/null @@ -1,131 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`simple 2`] = ` -"module.exports = -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = \\"\\"; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = \\"./test/fixture/index.js\\"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ \\"./test/fixture/foo.tsx\\": -/*!******************************!*\\\\ - !*** ./test/fixture/foo.tsx ***! - \\\\******************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -\\"use strict\\"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"default\\", function() { return Foo; }); -class Foo { - render() { - return React.createElement(\\"div\\", { - className: \\"hehe\\" - }, \\"hello there!!!\\"); - } -} - - -/***/ }), - -/***/ \\"./test/fixture/index.js\\": -/*!*******************************!*\\\\ - !*** ./test/fixture/index.js ***! - \\\\*******************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -\\"use strict\\"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _foo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foo */ \\"./test/fixture/foo.tsx\\"); - -console.log(_foo__WEBPACK_IMPORTED_MODULE_0__[\\"default\\"]); - - -/***/ }) - -/******/ });" -`; diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap new file mode 100644 index 00000000..b38a3f04 --- /dev/null +++ b/test/__snapshots__/loader.test.js.snap @@ -0,0 +1,966 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Loader js 1`] = ` +"module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = \\"\\"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = \\"./index.js\\"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ \\"./bar.js\\": +/*!***************!*\\\\ + !*** /bar.js ***! + \\\\***************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +console.log(\\"bar\\" + 1); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (Symbol(\\"bar\\")); + + +/***/ }), + +/***/ \\"./foo.js\\": +/*!***************!*\\\\ + !*** /foo.js ***! + \\\\***************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +console.log(\\"foo\\"); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (1); + + +/***/ }), + +/***/ \\"./index.js\\": +/*!*****************!*\\\\ + !*** /index.js ***! + \\\\*****************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _foo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../foo.js */ \\"./foo.js\\"); +/* harmony import */ var _bar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bar.js */ \\"./bar.js\\"); + + +console.log(_foo_js__WEBPACK_IMPORTED_MODULE_0__[\\"default\\"]); + + +/***/ }) + +/******/ });" +`; + +exports[`Loader tsx 1`] = ` +"module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = \\"\\"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = \\"./index.js\\"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ \\"./foo.tsx\\": +/*!****************!*\\\\ + !*** /foo.tsx ***! + \\\\****************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"default\\", function() { return Foo; }); +class Foo { + render() { + return React.createElement(\\"div\\", { + className: \\"hehe\\" + }, \\"hello there!!!\\"); + } +} + + +/***/ }), + +/***/ \\"./index.js\\": +/*!*****************!*\\\\ + !*** /index.js ***! + \\\\*****************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _foo_tsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../foo.tsx */ \\"./foo.tsx\\"); + +console.log(_foo_tsx__WEBPACK_IMPORTED_MODULE_0__[\\"default\\"]); + + +/***/ }) + +/******/ });" +`; + +exports[`Source-map source-map eval 1`] = ` +"module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = \\"\\"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = \\"./index.js\\"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ \\"./bar.js\\": +/*!***************!*\\\\ + !*** /bar.js ***! + \\\\***************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +eval(\\"__webpack_require__.r(__webpack_exports__);\\\\nconsole.log(\\\\\\"bar\\\\\\" + 1);\\\\n/* harmony default export */ __webpack_exports__[\\\\\\"default\\\\\\"] = (Symbol(\\\\\\"bar\\\\\\"));\\\\n//# sourceURL=[module]\\\\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL2Jhci5qcz8wOTFlIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNFO0FBQUEsUUFBUSxJQUFJLFFBQVE7QUFDTCxzRUFBTyIsImZpbGUiOiIuL2Jhci5qcy5qcyIsInNvdXJjZXNDb250ZW50IjpbIlxuICBjb25zb2xlLmxvZygnYmFyJyArIDEpO1xuICBleHBvcnQgZGVmYXVsdCBTeW1ib2woJ2JhcicpO1xuICAiXSwic291cmNlUm9vdCI6IiJ9\\\\n//# sourceURL=webpack-internal:///./bar.js\\\\n\\"); + +/***/ }), + +/***/ \\"./foo.js\\": +/*!***************!*\\\\ + !*** /foo.js ***! + \\\\***************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +eval(\\"__webpack_require__.r(__webpack_exports__);\\\\nconsole.log(\\\\\\"foo\\\\\\");\\\\n/* harmony default export */ __webpack_exports__[\\\\\\"default\\\\\\"] = (1);\\\\n//# sourceURL=[module]\\\\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL2Zvby5qcz9kZmEyIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNFO0FBQUEsUUFBUSxJQUFJO0FBQ0csZ0VBQUMsRUFBQyIsImZpbGUiOiIuL2Zvby5qcy5qcyIsInNvdXJjZXNDb250ZW50IjpbIlxuICBjb25zb2xlLmxvZygnZm9vJyk7XG4gIGV4cG9ydCBkZWZhdWx0IDE7XG4gICJdLCJzb3VyY2VSb290IjoiIn0=\\\\n//# sourceURL=webpack-internal:///./foo.js\\\\n\\"); + +/***/ }), + +/***/ \\"./index.js\\": +/*!*****************!*\\\\ + !*** /index.js ***! + \\\\*****************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +eval(\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony import */ var _foo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../foo.js */ \\\\\\"./foo.js\\\\\\");\\\\n/* harmony import */ var _bar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bar.js */ \\\\\\"./bar.js\\\\\\");\\\\n\\\\n\\\\nconsole.log(_foo_js__WEBPACK_IMPORTED_MODULE_0__[\\\\\\"default\\\\\\"]);\\\\n//# sourceURL=[module]\\\\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL2luZGV4LmpzP2UxYTAiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0k7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQUNBLFFBQVEsSUFBSSwrQ0FBRyIsImZpbGUiOiIuL2luZGV4LmpzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiXG4gICAgaW1wb3J0IEZvbyBmcm9tICcuL2Zvby5qcydcbiAgICBpbXBvcnQgQmFyIGZyb20gJy4vYmFyLmpzJ1xuICAgIGNvbnNvbGUubG9nKEZvbylcbiAgIl0sInNvdXJjZVJvb3QiOiIifQ==\\\\n//# sourceURL=webpack-internal:///./index.js\\\\n\\"); + +/***/ }) + +/******/ });" +`; + +exports[`Source-map source-map file 1`] = ` +"module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = \\"\\"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = \\"./index.js\\"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ \\"./bar.js\\": +/*!***************!*\\\\ + !*** /bar.js ***! + \\\\***************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +console.log(\\"bar\\" + 1); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (Symbol(\\"bar\\")); + + +/***/ }), + +/***/ \\"./foo.js\\": +/*!***************!*\\\\ + !*** /foo.js ***! + \\\\***************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +console.log(\\"foo\\"); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (1); + + +/***/ }), + +/***/ \\"./index.js\\": +/*!*****************!*\\\\ + !*** /index.js ***! + \\\\*****************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _foo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../foo.js */ \\"./foo.js\\"); +/* harmony import */ var _bar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bar.js */ \\"./bar.js\\"); + + +console.log(_foo_js__WEBPACK_IMPORTED_MODULE_0__[\\"default\\"]); + + +/***/ }) + +/******/ }); +//# sourceMappingURL=index.js.map" +`; + +exports[`Source-map source-map file 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:////bar.js\\",\\"webpack:////foo.js\\",\\"webpack:////index.js\\"],\\"names\\":[],\\"mappings\\":\\";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;ACjFE;AAAA,QAAQ,IAAI,QAAQ;AACL,sEAAO;;;;;;;;;;;;;ACDtB;AAAA,QAAQ,IAAI;AACG,gEAAC,EAAC;;;;;;;;;;;;;ACDf;AAAA;AAAA;AAAA;AACA;AACA,QAAQ,IAAI,+CAAG\\",\\"file\\":\\"index.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./index.js\\\\\\");\\\\n\\",\\"\\\\n console.log('bar' + 1);\\\\n export default Symbol('bar');\\\\n \\",\\"\\\\n console.log('foo');\\\\n export default 1;\\\\n \\",\\"\\\\n import Foo from './foo.js'\\\\n import Bar from './bar.js'\\\\n console.log(Foo)\\\\n \\"],\\"sourceRoot\\":\\"\\"}"`; + +exports[`Source-map source-map inline 1`] = ` +"module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = \\"\\"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = \\"./index.js\\"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ \\"./bar.js\\": +/*!***************!*\\\\ + !*** /bar.js ***! + \\\\***************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +console.log(\\"bar\\" + 1); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (Symbol(\\"bar\\")); + + +/***/ }), + +/***/ \\"./foo.js\\": +/*!***************!*\\\\ + !*** /foo.js ***! + \\\\***************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +console.log(\\"foo\\"); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (1); + + +/***/ }), + +/***/ \\"./index.js\\": +/*!*****************!*\\\\ + !*** /index.js ***! + \\\\*****************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _foo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../foo.js */ \\"./foo.js\\"); +/* harmony import */ var _bar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bar.js */ \\"./bar.js\\"); + + +console.log(_foo_js__WEBPACK_IMPORTED_MODULE_0__[\\"default\\"]); + + +/***/ }) + +/******/ }); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy9iYXIuanMiLCJ3ZW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jZVJvb3QiOiIifQ==" +`; + +exports[`Source-map source-map plugin 1`] = ` +"module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = \\"\\"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = \\"./index.js\\"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ \\"./bar.js\\": +/*!***************!*\\\\ + !*** /bar.js ***! + \\\\***************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +eval(\\"__webpack_require__.r(__webpack_exports__);\\\\nconsole.log(\\\\\\"bar\\\\\\" + 1);\\\\n/* harmony default export */ __webpack_exports__[\\\\\\"default\\\\\\"] = (Symbol(\\\\\\"bar\\\\\\"));\\\\n\\\\n\\\\n//# sourceURL=webpack:////bar.js?\\"); + +/***/ }), + +/***/ \\"./foo.js\\": +/*!***************!*\\\\ + !*** /foo.js ***! + \\\\***************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +eval(\\"__webpack_require__.r(__webpack_exports__);\\\\nconsole.log(\\\\\\"foo\\\\\\");\\\\n/* harmony default export */ __webpack_exports__[\\\\\\"default\\\\\\"] = (1);\\\\n\\\\n\\\\n//# sourceURL=webpack:////foo.js?\\"); + +/***/ }), + +/***/ \\"./index.js\\": +/*!*****************!*\\\\ + !*** /index.js ***! + \\\\*****************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +\\"use strict\\"; +eval(\\"__webpack_require__.r(__webpack_exports__);\\\\n/* harmony import */ var _foo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../foo.js */ \\\\\\"./foo.js\\\\\\");\\\\n/* harmony import */ var _bar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bar.js */ \\\\\\"./bar.js\\\\\\");\\\\n\\\\n\\\\nconsole.log(_foo_js__WEBPACK_IMPORTED_MODULE_0__[\\\\\\"default\\\\\\"]);\\\\n\\\\n\\\\n//# sourceURL=webpack:////index.js?\\"); + +/***/ }) + +/******/ }); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7UUFBQTtRQUNBOztRQUVBO1FBQ0E7O1FBRUE7UUFDQTtRQUNBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7O1FBRUE7UUFDQTs7UUFFQTtRQUNBOztRQUVBO1FBQ0E7UUFDQTs7O1FBR0E7UUFDQTs7UUFFQTtRQUNBOztRQUVBO1FBQ0E7UUFDQTtRQUNBLDBDQUEwQyxnQ0FBZ0M7UUFDMUU7UUFDQTs7UUFFQTtRQUNBO1FBQ0E7UUFDQSx3REFBd0Qsa0JBQWtCO1FBQzFFO1FBQ0EsaURBQWlELGNBQWM7UUFDL0Q7O1FBRUE7UUFDQTtRQUNBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7UUFDQTtRQUNBLHlDQUF5QyxpQ0FBaUM7UUFDMUUsZ0hBQWdILG1CQUFtQixFQUFFO1FBQ3JJO1FBQ0E7O1FBRUE7UUFDQTtRQUNBO1FBQ0EsMkJBQTJCLDBCQUEwQixFQUFFO1FBQ3ZELGlDQUFpQyxlQUFlO1FBQ2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REZWZhdWx0RXhwb3J0IGZ1bmN0aW9uIGZvciBjb21wYXRpYmlsaXR5IHdpdGggbm9uLWhhcm1vbnkgbW9kdWxlc1xuIFx0X193ZWJwYWNrX3JlcXVpcmVfXy5uID0gZnVuY3Rpb24obW9kdWxlKSB7XG4gXHRcdHZhciBnZXR0ZXIgPSBtb2R1bGUgJiYgbW9kdWxlLl9fZXNNb2R1bGUgP1xuIFx0XHRcdGZ1bmN0aW9uIGdldERlZmF1bHQoKSB7IHJldHVybiBtb2R1bGVbJ2RlZmF1bHQnXTsgfSA6XG4gXHRcdFx0ZnVuY3Rpb24gZ2V0TW9kdWxlRXhwb3J0cygpIHsgcmV0dXJuIG1vZHVsZTsgfTtcbiBcdFx0X193ZWJwYWNrX3JlcXVpcmVfXy5kKGdldHRlciwgJ2EnLCBnZXR0ZXIpO1xuIFx0XHRyZXR1cm4gZ2V0dGVyO1xuIFx0fTtcblxuIFx0Ly8gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsXG4gXHRfX3dlYnBhY2tfcmVxdWlyZV9fLm8gPSBmdW5jdGlvbihvYmplY3QsIHByb3BlcnR5KSB7IHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwob2JqZWN0LCBwcm9wZXJ0eSk7IH07XG5cbiBcdC8vIF9fd2VicGFja19wdWJsaWNfcGF0aF9fXG4gXHRfX3dlYnBhY2tfcmVxdWlyZV9fLnAgPSBcIlwiO1xuXG5cbiBcdC8vIExvYWQgZW50cnkgbW9kdWxlIGFuZCByZXR1cm4gZXhwb3J0c1xuIFx0cmV0dXJuIF9fd2VicGFja19yZXF1aXJlX18oX193ZWJwYWNrX3JlcXVpcmVfXy5zID0gXCIuL2luZGV4LmpzXCIpO1xuIl0sInNvdXJjZVJvb3QiOiIifQ==" +`; + +exports[`target 1`] = ` +"module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = \\"\\"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = \\"./index.js\\"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ \\"./index.js\\": +/*!*****************!*\\\\ + !*** /index.js ***! + \\\\*****************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +let __hasOwnProperty = Object.prototype.hasOwnProperty; +let __getOwnPropertySymbols = Object.getOwnPropertySymbols; +let __propertyIsEnumerable = Object.prototype.propertyIsEnumerable; +let __pow = Math.pow; +let __assign = Object.assign; +let __rest = (source, exclude) => { + let target = {}; + for (let prop in source) + if (__hasOwnProperty.call(source, prop) && exclude.indexOf(prop) < 0) + target[prop] = source[prop]; + if (source != null && __getOwnPropertySymbols) { + for (let prop of __getOwnPropertySymbols(source)) + if (exclude.indexOf(prop) < 0 && __propertyIsEnumerable.call(source, prop)) + target[prop] = source[prop]; + } + return target; +}; +let __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + let fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + let rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + let step = (result) => { + return result.done ? resolve(result.value) : Promise.resolve(result.value).then(fulfilled, rejected); + }; + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; +console.log(__pow(10, 4)); +() => __async(this, [], function* () { +}); +const y = {a: 1}; +let x = __assign({}, y); +let z = __rest(y, []); + + +/***/ }) + +/******/ });" +`; diff --git a/test/__snapshots__/minify.test.js.snap b/test/__snapshots__/minify.test.js.snap new file mode 100644 index 00000000..d6614416 --- /dev/null +++ b/test/__snapshots__/minify.test.js.snap @@ -0,0 +1,263 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Loader + Minification minify 1`] = ` +"module.exports=function(f){var d={};function b(a){if(d[a])return d[a].exports;var c=d[a]={i:a,l:!1,exports:{}};return f[a].call(c.exports,c,c.exports,b),c.l=!0,c.exports}return b.m=f,b.c=d,b.d=function(a,c,e){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:e})},b.r=function(a){typeof Symbol!==\\"undefined\\"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(a,\\"__esModule\\",{value:!0})},b.t=function(a,c){c&1&&(a=b(a));if(c&8)return a;if(c&4&&typeof a===\\"object\\"&&a&&a.__esModule)return a;var e=Object.create(null);b.r(e),Object.defineProperty(e,\\"default\\",{enumerable:!0,value:a});if(c&2&&typeof a!=\\"string\\")for(var g in a)b.d(e,g,function(h){return a[h]}.bind(null,g));return e},b.n=function(a){var c=a&&a.__esModule?function e(){return a.default}:function e(){return a};return b.d(c,\\"a\\",c),c},b.o=function(a,c){return Object.prototype.hasOwnProperty.call(a,c)},b.p=\\"\\",b(b.s=\\"./index.js\\")}({\\"./bar.js\\":function(f,d,b){\\"use strict\\";b.r(d),console.log(\\"bar\\"+1),d.default=Symbol(\\"bar\\")},\\"./foo.js\\":function(f,d,b){\\"use strict\\";b.r(d),console.log(\\"foo\\"),d.default=1},\\"./index.js\\":function(f,d,b){\\"use strict\\";b.r(d);var a=b(\\"./foo.js\\"),c=b(\\"./bar.js\\");console.log(a.default)}}); +" +`; + +exports[`Loader + Minification minify w/ devtool inline-source-map 1`] = ` +"module.exports=function(f){var d={};function b(a){if(d[a])return d[a].exports;var c=d[a]={i:a,l:!1,exports:{}};return f[a].call(c.exports,c,c.exports,b),c.l=!0,c.exports}return b.m=f,b.c=d,b.d=function(a,c,e){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:e})},b.r=function(a){typeof Symbol!==\\"undefined\\"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(a,\\"__esModule\\",{value:!0})},b.t=function(a,c){c&1&&(a=b(a));if(c&8)return a;if(c&4&&typeof a===\\"object\\"&&a&&a.__esModule)return a;var e=Object.create(null);b.r(e),Object.defineProperty(e,\\"default\\",{enumerable:!0,value:a});if(c&2&&typeof a!=\\"string\\")for(var g in a)b.d(e,g,function(h){return a[h]}.bind(null,g));return e},b.n=function(a){var c=a&&a.__esModule?function e(){return a.default}:function e(){return a};return b.d(c,\\"a\\",c),c},b.o=function(a,c){return Object.prototype.hasOwnProperty.call(a,c)},b.p=\\"\\",b(b.s=\\"./index.js\\")}({\\"./bar.js\\":function(f,d,b){\\"use strict\\";b.r(d),console.log(\\"bar\\"+1),d.default=Symbol(\\"bar\\")},\\"./foo.js\\":function(f,d,b){\\"use strict\\";b.r(d),console.log(\\"foo\\"),d.default=1},\\"./index.js\\":function(f,d,b){\\"use strict\\";b.r(d);var a=b(\\"./foo.js\\"),c=b(\\"./bar.js\\");console.log(a.default)}}); + +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy9iYXIuanMiLCJ3ZWJwYWNrOi8vLy9mb28uanMiLCJ3ZWJwYWNrOi8vLy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiMkJBQ0UsR0FBSSxHQUFtQixHQUd2QixXQUE2QixHQUc1QixHQUFHLEVBQWlCLEdBQ25CLE1BQU8sR0FBaUIsR0FBVSxRQUduQyxHQUFJLEdBQVMsRUFBaUIsR0FBWSxDQUN6QyxFQUFHLEVBQ0gsRUFBRyxHQUNILFFBQVMsSUFJVixTQUFRLEdBQVUsS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iKTtcbiIsIlxuICBjb25zb2xlLmxvZygnYmFyJyArIDEpO1xuICBleHBvcnQgZGVmYXVsdCBTeW1ib2woJ2JhcicpO1xuICAiLCJcbiAgY29uc29sZS5sb2coJ2ZvbycpO1xuICBleHBvcnQgZGVmYXVsdCAxO1xuICAiLCJcbiAgICBpbXBvcnQgRm9vIGZyb20gJy4vZm9vLmpzJ1xuICAgIGltcG9ydCBCYXIgZnJvbSAnLi9iYXIuanMnXG4gICAgY29uc29sZS5sb2coRm9vKVxuICAiXSwic291cmNlUm9vdCI6IiJ9" +`; + +exports[`Loader + Minification minify w/ devtool source-maps 1`] = ` +"module.exports=function(f){var d={};function b(a){if(d[a])return d[a].exports;var c=d[a]={i:a,l:!1,exports:{}};return f[a].call(c.exports,c,c.exports,b),c.l=!0,c.exports}return b.m=f,b.c=d,b.d=function(a,c,e){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:e})},b.r=function(a){typeof Symbol!==\\"undefined\\"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(a,\\"__esModule\\",{value:!0})},b.t=function(a,c){c&1&&(a=b(a));if(c&8)return a;if(c&4&&typeof a===\\"object\\"&&a&&a.__esModule)return a;var e=Object.create(null);b.r(e),Object.defineProperty(e,\\"default\\",{enumerable:!0,value:a});if(c&2&&typeof a!=\\"string\\")for(var g in a)b.d(e,g,function(h){return a[h]}.bind(null,g));return e},b.n=function(a){var c=a&&a.__esModule?function e(){return a.default}:function e(){return a};return b.d(c,\\"a\\",c),c},b.o=function(a,c){return Object.prototype.hasOwnProperty.call(a,c)},b.p=\\"\\",b(b.s=\\"./index.js\\")}({\\"./bar.js\\":function(f,d,b){\\"use strict\\";b.r(d),console.log(\\"bar\\"+1),d.default=Symbol(\\"bar\\")},\\"./foo.js\\":function(f,d,b){\\"use strict\\";b.r(d),console.log(\\"foo\\"),d.default=1},\\"./index.js\\":function(f,d,b){\\"use strict\\";b.r(d);var a=b(\\"./foo.js\\"),c=b(\\"./bar.js\\");console.log(a.default)}}); + +//# sourceMappingURL=index.js.map" +`; + +exports[`Loader + Minification minify w/ no devtool 1`] = ` +"module.exports=function(f){var e={};function c(a){if(e[a])return e[a].exports;var b=e[a]={i:a,l:!1,exports:{}};return f[a].call(b.exports,b,b.exports,c),b.l=!0,b.exports}return c.m=f,c.c=e,c.d=function(a,b,d){c.o(a,b)||Object.defineProperty(a,b,{enumerable:!0,get:d})},c.r=function(a){typeof Symbol!==\\"undefined\\"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(a,\\"__esModule\\",{value:!0})},c.t=function(a,b){b&1&&(a=c(a));if(b&8)return a;if(b&4&&typeof a===\\"object\\"&&a&&a.__esModule)return a;var d=Object.create(null);c.r(d),Object.defineProperty(d,\\"default\\",{enumerable:!0,value:a});if(b&2&&typeof a!=\\"string\\")for(var g in a)c.d(d,g,function(h){return a[h]}.bind(null,g));return d},c.n=function(a){var b=a&&a.__esModule?function d(){return a.default}:function d(){return a};return c.d(b,\\"a\\",b),b},c.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},c.p=\\"\\",c(c.s=\\"./index.js\\")}({\\"./bar.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +console.log(\\"bar\\" + 1); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (Symbol(\\"bar\\")); + + +//# sourceURL=webpack:////bar.js?\`)},\\"./foo.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +console.log(\\"foo\\"); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (1); + + +//# sourceURL=webpack:////foo.js?\`)},\\"./index.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _foo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../foo.js */ \\"./foo.js\\"); +/* harmony import */ var _bar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bar.js */ \\"./bar.js\\"); + + +console.log(_foo_js__WEBPACK_IMPORTED_MODULE_0__[\\"default\\"]); + + +//# sourceURL=webpack:////index.js?\`)}}); +" +`; + +exports[`Loader + Minification minify w/ sourcemap option 1`] = ` +"module.exports=function(f){var e={};function c(a){if(e[a])return e[a].exports;var b=e[a]={i:a,l:!1,exports:{}};return f[a].call(b.exports,b,b.exports,c),b.l=!0,b.exports}return c.m=f,c.c=e,c.d=function(a,b,d){c.o(a,b)||Object.defineProperty(a,b,{enumerable:!0,get:d})},c.r=function(a){typeof Symbol!==\\"undefined\\"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(a,\\"__esModule\\",{value:!0})},c.t=function(a,b){b&1&&(a=c(a));if(b&8)return a;if(b&4&&typeof a===\\"object\\"&&a&&a.__esModule)return a;var d=Object.create(null);c.r(d),Object.defineProperty(d,\\"default\\",{enumerable:!0,value:a});if(b&2&&typeof a!=\\"string\\")for(var g in a)c.d(d,g,function(h){return a[h]}.bind(null,g));return d},c.n=function(a){var b=a&&a.__esModule?function d(){return a.default}:function d(){return a};return c.d(b,\\"a\\",b),b},c.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},c.p=\\"\\",c(c.s=\\"./index.js\\")}({\\"./bar.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +console.log(\\"bar\\" + 1); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (Symbol(\\"bar\\")); + + +//# sourceURL=webpack:////bar.js?\`)},\\"./foo.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +console.log(\\"foo\\"); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (1); + + +//# sourceURL=webpack:////foo.js?\`)},\\"./index.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _foo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../foo.js */ \\"./foo.js\\"); +/* harmony import */ var _bar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bar.js */ \\"./bar.js\\"); + + +console.log(_foo_js__WEBPACK_IMPORTED_MODULE_0__[\\"default\\"]); + + +//# sourceURL=webpack:////index.js?\`)}}); +" +`; + +exports[`Loader + Minification minify w/ sourcemap option and source-map plugin external 1`] = ` +"module.exports=function(f){var e={};function c(a){if(e[a])return e[a].exports;var b=e[a]={i:a,l:!1,exports:{}};return f[a].call(b.exports,b,b.exports,c),b.l=!0,b.exports}return c.m=f,c.c=e,c.d=function(a,b,d){c.o(a,b)||Object.defineProperty(a,b,{enumerable:!0,get:d})},c.r=function(a){typeof Symbol!==\\"undefined\\"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(a,\\"__esModule\\",{value:!0})},c.t=function(a,b){b&1&&(a=c(a));if(b&8)return a;if(b&4&&typeof a===\\"object\\"&&a&&a.__esModule)return a;var d=Object.create(null);c.r(d),Object.defineProperty(d,\\"default\\",{enumerable:!0,value:a});if(b&2&&typeof a!=\\"string\\")for(var g in a)c.d(d,g,function(h){return a[h]}.bind(null,g));return d},c.n=function(a){var b=a&&a.__esModule?function d(){return a.default}:function d(){return a};return c.d(b,\\"a\\",b),b},c.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},c.p=\\"\\",c(c.s=\\"./index.js\\")}({\\"./bar.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +console.log(\\"bar\\" + 1); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (Symbol(\\"bar\\")); + + +//# sourceURL=webpack:////bar.js?\`)},\\"./foo.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +console.log(\\"foo\\"); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (1); + + +//# sourceURL=webpack:////foo.js?\`)},\\"./index.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _foo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../foo.js */ \\"./foo.js\\"); +/* harmony import */ var _bar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bar.js */ \\"./bar.js\\"); + + +console.log(_foo_js__WEBPACK_IMPORTED_MODULE_0__[\\"default\\"]); + + +//# sourceURL=webpack:////index.js?\`)}}); + +//# sourceMappingURL=index.js.map" +`; + +exports[`Loader + Minification minify w/ sourcemap option and source-map plugin external 2`] = `"{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\"],\\"names\\":[],\\"mappings\\":\\"2BACE,GAAI,GAAmB,GAGvB,WAA6B,GAG5B,GAAG,EAAiB,GACnB,MAAO,GAAiB,GAAU,QAGnC,GAAI,GAAS,EAAiB,GAAY,CACzC,EAAG,EACH,EAAG,GACH,QAAS,IAIV,SAAQ,GAAU,KAAK,EAAO,QAAS,EAAQ,EAAO,QAAS,GAG/D,EAAO,EAAI,GAGJ,EAAO,QAKf,SAAoB,EAAI,EAGxB,EAAoB,EAAI,EAGxB,EAAoB,EAAI,SAAS,EAAS,EAAM,GAC3C,EAAoB,EAAE,EAAS,IAClC,OAAO,eAAe,EAAS,EAAM,CAAE,WAAY,GAAM,IAAK,KAKhE,EAAoB,EAAI,SAAS,GAC7B,MAAO,UAAW,aAAe,OAAO,aAC1C,OAAO,eAAe,EAAS,OAAO,YAAa,CAAE,MAAO,WAE7D,OAAO,eAAe,EAAS,aAAc,CAAE,MAAO,MAQvD,EAAoB,EAAI,SAAS,EAAO,GACpC,EAAO,GAAG,GAAQ,EAAoB,IACzC,GAAG,EAAO,EAAG,MAAO,GACpB,GAAI,EAAO,GAAM,MAAO,KAAU,UAAY,GAAS,EAAM,WAAY,MAAO,GAChF,GAAI,GAAK,OAAO,OAAO,MACvB,EAAoB,EAAE,GACtB,OAAO,eAAe,EAAI,UAAW,CAAE,WAAY,GAAM,MAAO,IAChE,GAAG,EAAO,GAAK,MAAO,IAAS,SAAU,OAAQ,KAAO,GAAO,EAAoB,EAAE,EAAI,EAAK,SAAS,GAAO,MAAO,GAAM,IAAQ,KAAK,KAAM,IAC9I,MAAO,IAIR,EAAoB,EAAI,SAAS,GAChC,GAAI,GAAS,GAAU,EAAO,WAC7B,aAAwB,MAAO,GAAO,SACtC,aAA8B,MAAO,IACtC,SAAoB,EAAE,EAAQ,IAAK,GAC5B,GAIR,EAAoB,EAAI,SAAS,EAAQ,GAAY,MAAO,QAAO,UAAU,eAAe,KAAK,EAAQ,IAGzG,EAAoB,EAAI,GAIjB,EAAoB,EAAoB,EAAI,e\\",\\"file\\":\\"index.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = \\\\\\"./index.js\\\\\\");\\\\n\\"],\\"sourceRoot\\":\\"\\"}"`; + +exports[`Loader + Minification minify w/ sourcemap option and source-map plugin inline 1`] = ` +"module.exports=function(f){var e={};function c(a){if(e[a])return e[a].exports;var b=e[a]={i:a,l:!1,exports:{}};return f[a].call(b.exports,b,b.exports,c),b.l=!0,b.exports}return c.m=f,c.c=e,c.d=function(a,b,d){c.o(a,b)||Object.defineProperty(a,b,{enumerable:!0,get:d})},c.r=function(a){typeof Symbol!==\\"undefined\\"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(a,\\"__esModule\\",{value:!0})},c.t=function(a,b){b&1&&(a=c(a));if(b&8)return a;if(b&4&&typeof a===\\"object\\"&&a&&a.__esModule)return a;var d=Object.create(null);c.r(d),Object.defineProperty(d,\\"default\\",{enumerable:!0,value:a});if(b&2&&typeof a!=\\"string\\")for(var g in a)c.d(d,g,function(h){return a[h]}.bind(null,g));return d},c.n=function(a){var b=a&&a.__esModule?function d(){return a.default}:function d(){return a};return c.d(b,\\"a\\",b),b},c.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},c.p=\\"\\",c(c.s=\\"./index.js\\")}({\\"./bar.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +console.log(\\"bar\\" + 1); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (Symbol(\\"bar\\")); + + +//# sourceURL=webpack:////bar.js?\`)},\\"./foo.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +console.log(\\"foo\\"); +/* harmony default export */ __webpack_exports__[\\"default\\"] = (1); + + +//# sourceURL=webpack:////foo.js?\`)},\\"./index.js\\":function(module,__webpack_exports__,__webpack_require__){\\"use strict\\";eval(\`__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _foo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../foo.js */ \\"./foo.js\\"); +/* harmony import */ var _bar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bar.js */ \\"./bar.js\\"); + + +console.log(_foo_js__WEBPACK_IMPORTED_MODULE_0__[\\"default\\"]); + + +//# sourceURL=webpack:////index.js?\`)}}); + +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjJCQUNFLEdBQUksR0FBbUIsR0FHdkIsV0FBNkIsR0FHNUIsR0FBRyxFQUFpQixHQUNuQixNQUFPLEdBQWlCLEdBQVUsUUFHbkMsR0FBSSxHQUFTLEVBQWlCLEdBQVksQ0FDekMsRUFBRyxFQUNILEVBQUcsR0FDSCxRQUFTLElBSVYsU0FBUSxHQUFVLEtBQUssRUFBTyxRQUFTLEVBQVEsRUFBTyxRQUFTLEdBRy9ELEVBQU8sRUFBSSxHQUdKLEVBQU8sUUFLZixTQUFvQixFQUFJLEVBR3hCLEVBQW9CLEVBQUksRUFHeEIsRUFBb0IsRUFBSSxTQUFTLEVBQVMsRU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KG1vZHVsZSkge1xuIFx0XHR2YXIgZ2V0dGVyID0gbW9kdWxlICYmIG1vZHVsZS5fX2VzTW9kdWxlID9cbiBcdFx0XHRmdW5jdGlvbiBnZXREZWZhdWx0KCkgeyByZXR1cm4gbW9kdWxlWydkZWZhdWx0J107IH0gOlxuIFx0XHRcdGZ1bmN0aW9uIGdldE1vZHVsZUV4cG9ydHMoKSB7IHJldHVybiBtb2R1bGU7IH07XG4gXHRcdF9fd2VicGFja19yZXF1aXJlX18uZChnZXR0ZXIsICdhJywgZ2V0dGVyKTtcbiBcdFx0cmV0dXJuIGdldHRlcjtcbiBcdH07XG5cbiBcdC8vIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbFxuIFx0X193ZWJwYWNrX3JlcXVpcmVfXy5vID0gZnVuY3Rpb24ob2JqZWN0LCBwcm9wZXJ0eSkgeyByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwgcHJvcGVydHkpOyB9O1xuXG4gXHQvLyBfX3dlYnBhY2tfcHVibGljX3BhdGhfX1xuIFx0X193ZWJwYWNrX3JlcXVpcmVfXy5wID0gXCJcIjtcblxuXG4gXHQvLyBMb2FkIGVudHJ5IG1vZHVsZSBhbmQgcmV0dXJuIGV4cG9ydHNcbiBcdHJldHVybiBfX3dlYnBhY2tfcmVxdWlyZV9fKF9fd2VicGFja19yZXF1aXJlX18ucyA9IFwiLi9pbmRleC5qc1wiKTtcbiJdLCJzb3VyY2VSb290IjoiIn0=" +`; + +exports[`Loader + Minification minifyIdentifiers 1`] = ` +"module.exports = function(f) { + var d = {}; + function b(a) { + if (d[a]) { + return d[a].exports; + } + var c = d[a] = { + i: a, + l: false, + exports: {} + }; + f[a].call(c.exports, c, c.exports, b); + c.l = true; + return c.exports; + } + b.m = f; + b.c = d; + b.d = function(a, c, e) { + if (!b.o(a, c)) { + Object.defineProperty(a, c, {enumerable: true, get: e}); + } + }; + b.r = function(a) { + if (typeof Symbol !== \\"undefined\\" && Symbol.toStringTag) { + Object.defineProperty(a, Symbol.toStringTag, {value: \\"Module\\"}); + } + Object.defineProperty(a, \\"__esModule\\", {value: true}); + }; + b.t = function(a, c) { + if (c & 1) + a = b(a); + if (c & 8) + return a; + if (c & 4 && typeof a === \\"object\\" && a && a.__esModule) + return a; + var e = Object.create(null); + b.r(e); + Object.defineProperty(e, \\"default\\", {enumerable: true, value: a}); + if (c & 2 && typeof a != \\"string\\") + for (var g in a) + b.d(e, g, function(h) { + return a[h]; + }.bind(null, g)); + return e; + }; + b.n = function(a) { + var c = a && a.__esModule ? function e() { + return a[\\"default\\"]; + } : function e() { + return a; + }; + b.d(c, \\"a\\", c); + return c; + }; + b.o = function(a, c) { + return Object.prototype.hasOwnProperty.call(a, c); + }; + b.p = \\"\\"; + return b(b.s = \\"./index.js\\"); +}({ + \\"./bar.js\\": function(f, d, b) { + \\"use strict\\"; + b.r(d); + console.log(\\"bar\\" + 1); + d[\\"default\\"] = Symbol(\\"bar\\"); + }, + \\"./foo.js\\": function(f, d, b) { + \\"use strict\\"; + b.r(d); + console.log(\\"foo\\"); + d[\\"default\\"] = 1; + }, + \\"./index.js\\": function(f, d, b) { + \\"use strict\\"; + b.r(d); + var a = b(\\"./foo.js\\"); + var c = b(\\"./bar.js\\"); + console.log(a[\\"default\\"]); + } +}); +" +`; + +exports[`Loader + Minification minifySyntax 1`] = ` +"module.exports = function(modules) { + var installedModules = {}; + function __webpack_require__(moduleId) { + if (installedModules[moduleId]) + return installedModules[moduleId].exports; + var module2 = installedModules[moduleId] = { + i: moduleId, + l: false, + exports: {} + }; + return modules[moduleId].call(module2.exports, module2, module2.exports, __webpack_require__), module2.l = true, module2.exports; + } + return __webpack_require__.m = modules, __webpack_require__.c = installedModules, __webpack_require__.d = function(exports, name, getter) { + __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {enumerable: true, get: getter}); + }, __webpack_require__.r = function(exports) { + typeof Symbol !== \\"undefined\\" && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {value: \\"Module\\"}), Object.defineProperty(exports, \\"__esModule\\", {value: true}); + }, __webpack_require__.t = function(value, mode) { + mode & 1 && (value = __webpack_require__(value)); + if (mode & 8) + return value; + if (mode & 4 && typeof value === \\"object\\" && value && value.__esModule) + return value; + var ns = Object.create(null); + __webpack_require__.r(ns), Object.defineProperty(ns, \\"default\\", {enumerable: true, value}); + if (mode & 2 && typeof value != \\"string\\") + for (var key in value) + __webpack_require__.d(ns, key, function(key2) { + return value[key2]; + }.bind(null, key)); + return ns; + }, __webpack_require__.n = function(module2) { + var getter = module2 && module2.__esModule ? function getDefault() { + return module2.default; + } : function getModuleExports() { + return module2; + }; + return __webpack_require__.d(getter, \\"a\\", getter), getter; + }, __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }, __webpack_require__.p = \\"\\", __webpack_require__(__webpack_require__.s = \\"./index.js\\"); +}({ + \\"./bar.js\\": function(module2, __webpack_exports__, __webpack_require__) { + \\"use strict\\"; + __webpack_require__.r(__webpack_exports__), console.log(\\"bar\\" + 1), __webpack_exports__.default = Symbol(\\"bar\\"); + }, + \\"./foo.js\\": function(module2, __webpack_exports__, __webpack_require__) { + \\"use strict\\"; + __webpack_require__.r(__webpack_exports__), console.log(\\"foo\\"), __webpack_exports__.default = 1; + }, + \\"./index.js\\": function(module2, __webpack_exports__, __webpack_require__) { + \\"use strict\\"; + __webpack_require__.r(__webpack_exports__); + var _foo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\\"./foo.js\\"), _bar_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\\"./bar.js\\"); + console.log(_foo_js__WEBPACK_IMPORTED_MODULE_0__.default); + } +}); +" +`; + +exports[`Loader + Minification minifyWhitespace 1`] = ` +"module.exports=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module2=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};modules[moduleId].call(module2.exports,module2,module2.exports,__webpack_require__);module2.l=!0;return module2.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{enumerable:!0,get:getter})}};__webpack_require__.r=function(exports){if(typeof Symbol!==\\"undefined\\"&&Symbol.toStringTag){Object.defineProperty(exports,Symbol.toStringTag,{value:\\"Module\\"})}Object.defineProperty(exports,\\"__esModule\\",{value:!0})};__webpack_require__.t=function(value,mode){if(mode&1)value=__webpack_require__(value);if(mode&8)return value;if(mode&4&&typeof value===\\"object\\"&&value&&value.__esModule)return value;var ns=Object.create(null);__webpack_require__.r(ns);Object.defineProperty(ns,\\"default\\",{enumerable:!0,value});if(mode&2&&typeof value!=\\"string\\")for(var key in value)__webpack_require__.d(ns,key,function(key2){return value[key2]}.bind(null,key));return ns};__webpack_require__.n=function(module2){var getter=module2&&module2.__esModule?function getDefault(){return module2[\\"default\\"]}:function getModuleExports(){return module2};__webpack_require__.d(getter,\\"a\\",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p=\\"\\";return __webpack_require__(__webpack_require__.s=\\"./index.js\\")}({\\"./bar.js\\":function(module2,__webpack_exports__,__webpack_require__){\\"use strict\\";__webpack_require__.r(__webpack_exports__);console.log(\\"bar\\"+1);__webpack_exports__[\\"default\\"]=Symbol(\\"bar\\")},\\"./foo.js\\":function(module2,__webpack_exports__,__webpack_require__){\\"use strict\\";__webpack_require__.r(__webpack_exports__);console.log(\\"foo\\");__webpack_exports__[\\"default\\"]=1},\\"./index.js\\":function(module2,__webpack_exports__,__webpack_require__){\\"use strict\\";__webpack_require__.r(__webpack_exports__);var _foo_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(\\"./foo.js\\");var _bar_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(\\"./bar.js\\");console.log(_foo_js__WEBPACK_IMPORTED_MODULE_0__[\\"default\\"])}}); +" +`; diff --git a/test/build.js b/test/build.js new file mode 100644 index 00000000..c6b569e9 --- /dev/null +++ b/test/build.js @@ -0,0 +1,74 @@ +const webpack = require('webpack') +const path = require('path') +const fs = require('fs') +const { ufs } = require('unionfs') +const { Volume } = require('memfs') + +const { ESBuildPlugin } = require('../src') +const esbuildLoader = require.resolve('../src') + +function build(volJson, configure) { + return new Promise((resolve, reject) => { + const mfs = Volume.fromJSON(volJson) + mfs.join = path.join.bind(path) + + let config = { + mode: 'development', + devtool: false, + + context: '/', + entry: '/index.js', + output: { + path: '/dist', + filename: 'index.js', + libraryTarget: 'commonjs2', + }, + + resolveLoader: { + alias: { + 'esbuild-loader': esbuildLoader, + }, + }, + + module: { + rules: [ + { + test: /\.js$/, + loader: 'esbuild-loader', + }, + ], + }, + plugins: [new ESBuildPlugin()], + } + + if (typeof configure === 'function') { + configure(config) + } + + const compiler = webpack(config) + + compiler.inputFileSystem = ufs.use(fs).use(mfs) + compiler.outputFileSystem = mfs + + compiler.run((err, stats) => { + if (err) { + reject(err) + return + } + + if (stats.compilation.errors.length > 0) { + reject(stats.compilation.errors) + return + } + + if (stats.compilation.warnings.length > 0) { + reject(stats.compilation.warnings) + return + } + + resolve(stats) + }) + }) +} + +module.exports = build diff --git a/test/fixture/foo.tsx b/test/fixture/foo.tsx deleted file mode 100644 index 281a1600..00000000 --- a/test/fixture/foo.tsx +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - render() { - return
hello there!!!
- } -} \ No newline at end of file diff --git a/test/fixture/index.js b/test/fixture/index.js deleted file mode 100644 index d09757c9..00000000 --- a/test/fixture/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Foo from './foo' - -console.log(Foo) \ No newline at end of file diff --git a/test/fixtures.js b/test/fixtures.js new file mode 100644 index 00000000..d5f91ef1 --- /dev/null +++ b/test/fixtures.js @@ -0,0 +1,52 @@ +const js = { + '/index.js': ` + import Foo from './foo.js' + import Bar from './bar.js' + console.log(Foo) + `, + + '/foo.js': ` + console.log('foo'); + export default 1; + `, + '/bar.js': ` + console.log('bar' + 1); + export default Symbol('bar'); + `, +} + +const tsx = { + '/index.js': ` + import Foo from './foo.tsx' + console.log(Foo) + `, + + '/foo.tsx': ` + export default class Foo { + render() { + return
hello there!!!
+ } + } + `, +} + +const target = { + '/index.js': ` + // es2016 + console.log(10 ** 4) + + // es2017 + async () => {} + + // 2018 + const y = { a: 1 }; + let x = {...y} + let {...z} = y + `, +} + +module.exports = { + js, + tsx, + target, +} diff --git a/test/index.test.js b/test/index.test.js deleted file mode 100644 index 04e57154..00000000 --- a/test/index.test.js +++ /dev/null @@ -1,42 +0,0 @@ -const { promisify } = require('util') -const webpack = require('webpack') -const { ESBuildPlugin } = require('../src') - -const esbuildLoader = require.resolve('../src') - -test('simple', async () => { - const compiler = webpack({ - mode: 'development', - devtool: false, - entry: __dirname + '/fixture/index.js', - output: { - path: __dirname + '/fixture/dist', - filename: 'index.js', - libraryTarget: 'commonjs2', - }, - resolve: { - extensions: ['.js', '.tsx', '.ts', '.jsx', '.json'], - }, - module: { - rules: [ - { - test: /\.[jt]sx?$/, - loader: esbuildLoader, - }, - ], - }, - plugins: [new ESBuildPlugin()], - }) - let assets - compiler.hooks.done.tap('test', (stats) => { - console.log(stats.toString('minimal')) - assets = stats.compilation.assets - }) - await promisify(compiler.run.bind(compiler))() - expect(Object.keys(assets)).toMatchInlineSnapshot(` - Array [ - "index.js", - ] - `) - expect(assets['index.js'].source()).toMatchSnapshot() -}) diff --git a/test/loader.test.js b/test/loader.test.js new file mode 100644 index 00000000..60393ce2 --- /dev/null +++ b/test/loader.test.js @@ -0,0 +1,80 @@ +const webpack = require('webpack') +const build = require('./build') +const { ESBuildMinifyPlugin } = require('../src') +const fixtures = require('./fixtures') + +describe('Loader', () => { + test('js', async () => { + const stats = await build(fixtures.js) + + const { assets } = stats.compilation + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('tsx', async () => { + const stats = await build(fixtures.tsx, (config) => { + config.module.rules.push({ + test: /\.tsx$/, + loader: 'esbuild-loader', + options: { + loader: 'tsx', + }, + }) + }) + + const { assets } = stats.compilation + expect(assets['index.js'].source()).toMatchSnapshot() + }) +}) + +// Targets +test('target', async () => { + const stats = await build(fixtures.target, (config) => { + config.module.rules[0].options = { + target: 'es2015', + } + }) + + const { assets } = stats.compilation + expect(assets['index.js'].source()).toMatchSnapshot() +}) + +describe('Source-map', () => { + test('source-map eval', async () => { + const stats = await build(fixtures.js, (config) => { + config.devtool = 'eval-source-map' + }) + + const { assets } = stats.compilation + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('source-map inline', async () => { + const stats = await build(fixtures.js, (config) => { + config.devtool = 'inline-source-map' + }) + + const { assets } = stats.compilation + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('source-map file', async () => { + const stats = await build(fixtures.js, (config) => { + config.devtool = 'source-map' + }) + + const { assets } = stats.compilation + expect(assets['index.js'].source()).toMatchSnapshot() + expect(assets['index.js.map'].source()).toMatchSnapshot() + }) + + test('source-map plugin', async () => { + const stats = await build(fixtures.js, (config) => { + delete config.devtool + config.plugins.push(new webpack.SourceMapDevToolPlugin({})) + }) + + const { assets } = stats.compilation + expect(assets['index.js'].source()).toMatchSnapshot() + }) +}) diff --git a/test/minify.test.js b/test/minify.test.js new file mode 100644 index 00000000..35e6f923 --- /dev/null +++ b/test/minify.test.js @@ -0,0 +1,163 @@ +const webpack = require('webpack') +const build = require('./build') +const { ESBuildMinifyPlugin } = require('../src') +const fixtures = require('./fixtures') + +describe('Loader + Minification', () => { + test('minify', async () => { + const stats = await build(fixtures.js, (config) => { + config.optimization = { + minimize: true, + minimizer: [new ESBuildMinifyPlugin()], + } + }) + + const assets = stats.compilation.assets + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('minifyWhitespace', async () => { + const stats = await build(fixtures.js, (config) => { + config.optimization = { + minimize: true, + minimizer: [ + new ESBuildMinifyPlugin({ + minifyWhitespace: true, + }), + ], + } + }) + + const assets = stats.compilation.assets + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('minifyIdentifiers', async () => { + const stats = await build(fixtures.js, (config) => { + config.optimization = { + minimize: true, + minimizer: [ + new ESBuildMinifyPlugin({ + minifyIdentifiers: true, + }), + ], + } + }) + + const assets = stats.compilation.assets + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('minifySyntax', async () => { + const stats = await build(fixtures.js, (config) => { + config.optimization = { + minimize: true, + minimizer: [ + new ESBuildMinifyPlugin({ + minifySyntax: true, + }), + ], + } + }) + + const assets = stats.compilation.assets + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('minify w/ no devtool', async () => { + const stats = await build(fixtures.js, (config) => { + delete config.devtool + config.optimization = { + minimize: true, + minimizer: [new ESBuildMinifyPlugin()], + } + }) + + const assets = stats.compilation.assets + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('minify w/ devtool inline-source-map', async () => { + const stats = await build(fixtures.js, (config) => { + config.devtool = 'inline-source-map' + config.optimization = { + minimize: true, + minimizer: [new ESBuildMinifyPlugin()], + } + }) + + const assets = stats.compilation.assets + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('minify w/ devtool source-maps', async () => { + const stats = await build(fixtures.js, (config) => { + config.devtool = 'source-map' + config.optimization = { + minimize: true, + minimizer: [new ESBuildMinifyPlugin()], + } + }) + + const assets = stats.compilation.assets + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('minify w/ sourcemap option', async () => { + const stats = await build(fixtures.js, (config) => { + delete config.devtool + config.optimization = { + minimize: true, + minimizer: [ + new ESBuildMinifyPlugin({ + sourcemap: true, + }), + ], + } + }) + + const assets = stats.compilation.assets + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('minify w/ sourcemap option and source-map plugin inline', async () => { + const stats = await build(fixtures.js, (config) => { + delete config.devtool + config.optimization = { + minimize: true, + minimizer: [ + new ESBuildMinifyPlugin({ + sourcemap: true, + }), + ], + } + config.plugins.push(new webpack.SourceMapDevToolPlugin({})) + }) + + const assets = stats.compilation.assets + expect(assets['index.js'].source()).toMatchSnapshot() + }) + + test('minify w/ sourcemap option and source-map plugin external', async () => { + const stats = await build(fixtures.js, (config) => { + delete config.devtool + config.optimization = { + minimize: true, + minimizer: [ + new ESBuildMinifyPlugin({ + sourcemap: true, + }), + ], + } + config.plugins.push( + new webpack.SourceMapDevToolPlugin({ + filename: 'index.js.map', + }) + ) + }) + + const assets = stats.compilation.assets + expect(assets['index.js'].source()).toMatchSnapshot() + expect(assets['index.js.map'].source()).toMatchSnapshot() + }) +}) diff --git a/yarn.lock b/yarn.lock index f038e9b4..80acf8bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2017,6 +2017,11 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" +fs-monkey@1.0.1, fs-monkey@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-1.0.1.tgz#4a82f36944365e619f4454d9fff106553067b781" + integrity sha512-fcSa+wyTqZa46iWweI7/ZiUfegOZl0SG8+dltIwFXo7+zYU9J9kpS3NB6pZcSlJdhvIwp81Adx2XhZorncxiaA== + fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" @@ -3157,6 +3162,13 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" +memfs@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.2.0.tgz#f9438e622b5acd1daa8a4ae160c496fdd1325b26" + integrity sha512-f/xxz2TpdKv6uDn6GtHee8ivFyxwxmPuXatBb1FBwxYNuVpbM3k/Y1Z+vC0mH/dIXXrukYfe3qe5J32Dfjg93A== + dependencies: + fs-monkey "1.0.1" + memory-fs@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" @@ -4634,6 +4646,13 @@ union-value@^1.0.0: is-extendable "^0.1.1" set-value "^2.0.1" +unionfs@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/unionfs/-/unionfs-4.4.0.tgz#b671112e505f70678052345cf5c2a33f0e6edde9" + integrity sha512-N+TuJHJ3PjmzIRCE1d2N3VN4qg/P78eh/nxzwHnzpg3W2Mvf8Wvi7J1mvv6eNkb8neUeSdFSQsKna0eXVyF4+w== + dependencies: + fs-monkey "^1.0.0" + unique-filename@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230" @@ -4786,7 +4805,7 @@ webidl-conversions@^6.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514" integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w== -webpack-sources@^1.4.0, webpack-sources@^1.4.1: +webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-sources@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933" integrity sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==