├── test ├── fixtures │ ├── build-typescript │ │ ├── tsconfig.json │ │ ├── package.json │ │ └── index.tsx │ ├── build-autoprefix │ │ ├── index.js │ │ ├── package.json │ │ └── index.css │ ├── build-hash-map │ │ ├── index.js │ │ ├── package.json │ │ └── webpack.config.js │ ├── build-normal │ │ ├── index.js │ │ └── package.json │ ├── build-dedupePlugin-enabled │ │ ├── oo.js │ │ ├── xx.js │ │ ├── node_modules │ │ │ ├── a │ │ │ │ ├── node_modules │ │ │ │ │ └── c │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── package.json │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ └── b │ │ │ │ ├── node_modules │ │ │ │ └── c │ │ │ │ │ ├── index.js │ │ │ │ │ └── package.json │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ ├── index.js │ │ └── package.json │ ├── build-mergeCustomConfig-path │ │ ├── index.js │ │ ├── package.json │ │ ├── webpack.config.js │ │ └── webpack.config.path.js │ ├── build-mergeCustomConfig-plugins │ │ ├── index.js │ │ ├── package.json │ │ └── webpack.config.js │ ├── build-add-module-exports │ │ ├── a.js │ │ ├── index.js │ │ └── package.json │ ├── build-jsx │ │ ├── index.js │ │ └── package.json │ ├── build-mergeCustomConfig-babel │ │ ├── index.js │ │ ├── package.json │ │ └── webpack.config.js │ ├── transformLess │ │ ├── b.less │ │ ├── node_modules │ │ │ └── external-package │ │ │ │ └── c.less │ │ └── a.less │ ├── build-common │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── index.css │ │ └── package.json │ ├── build-i18n │ │ ├── de.json │ │ ├── package.json │ │ ├── index.js │ │ └── webpack.config.js │ ├── build-no-entry │ │ └── package.json │ ├── build-svg │ │ ├── index.js │ │ ├── index.less │ │ ├── package.json │ │ └── info.svg │ ├── build-theme │ │ ├── index.js │ │ ├── index.less │ │ ├── antui-config.js │ │ └── package.json │ ├── build-font │ │ ├── index.js │ │ ├── package.json │ │ ├── webfont.eot │ │ ├── webfont.ttf │ │ ├── webfont.woff │ │ ├── index.html │ │ └── index.less │ ├── build-node-builtins │ │ ├── index.js │ │ └── package.json │ ├── mergeCustomConfig-error │ │ └── webpack.config.js │ ├── build-es3 │ │ ├── index.js │ │ ├── a.js │ │ └── package.json │ ├── build-json │ │ ├── index.js │ │ └── package.json │ ├── build-less │ │ ├── index.js │ │ ├── package.json │ │ └── index.less │ ├── build-mergeCustomConfig-environment-development │ │ ├── index.js │ │ └── package.json │ ├── build-mergeCustomConfig-environment-production │ │ ├── index.js │ │ └── package.json │ ├── build-class-property │ │ ├── package.json │ │ ├── 1.html │ │ └── 1.js │ ├── build-css-modules │ │ ├── package.json │ │ ├── index.js │ │ └── index.module.less │ ├── build-decorator │ │ ├── package.json │ │ └── index.js │ └── mergeCustomConfig-function │ │ └── webpack.config.js ├── expect │ ├── build-theme │ │ ├── index.css │ │ ├── index.js │ │ └── common.js │ ├── build-common │ │ ├── common.css │ │ ├── b.js │ │ └── a.js │ ├── build-normal │ │ ├── map.json │ │ ├── index-9ef985f8fe74a50efc00.js │ │ └── common-8d2b1e3a44d8c25d78f8.js │ ├── build-mergeCustomConfig-environment-production │ │ ├── index.js │ │ └── common.js │ ├── build-less │ │ ├── index.css │ │ ├── index.js │ │ └── common.js │ ├── build-hash-map │ │ └── build-hash-map │ │ │ └── 0.0.1 │ │ │ ├── map.json │ │ │ ├── index-6ac733341b735e19fafd.js │ │ │ ├── index-9ef985f8fe74a50efc00.js │ │ │ ├── common-64056faf0c20a36e10a6.js │ │ │ └── common-8d2b1e3a44d8c25d78f8.js │ ├── build-autoprefix │ │ ├── index.css │ │ ├── index.js │ │ └── common.js │ ├── build-mergeCustomConfig-babel │ │ ├── index.js │ │ └── common.js │ ├── build-i18n │ │ ├── app.de.js │ │ ├── app.en.js │ │ └── common.js │ ├── build-mergeCustomConfig-environment-development │ │ ├── index.js │ │ └── common.js │ ├── build-jsx │ │ ├── index.js │ │ └── common.js │ ├── build-class-property │ │ ├── 1.html │ │ ├── index.js │ │ └── common.js │ ├── build-css-modules │ │ ├── index.css │ │ ├── index.js │ │ └── common.js │ ├── build-svg │ │ ├── index.js │ │ ├── index.css │ │ └── common.js │ ├── transformLess │ │ └── a.css │ ├── build-font │ │ ├── index.html │ │ ├── index.js │ │ └── common.js │ ├── build-node-builtins │ │ ├── index.js │ │ └── common.js │ ├── build-json │ │ ├── index.js │ │ └── common.js │ ├── build-es3 │ │ ├── index.js │ │ └── common.js │ ├── build-decorator │ │ ├── index.js │ │ └── common.js │ ├── build-add-module-exports │ │ ├── index.js │ │ └── common.js │ ├── build-typescript │ │ ├── index.js │ │ └── common.js │ ├── build-dedupePlugin-enabled │ │ ├── index.js │ │ └── common.js │ ├── build-mergeCustomConfig-path │ │ └── index.js │ └── build-mergeCustomConfig-plugins │ │ └── index.js ├── transformLess-test.js ├── mergeCustomConfig-test.js └── build-test.js ├── .eslintignore ├── src ├── webpack.js ├── dependencies.js ├── getTSCommonConfig.js ├── getBabelCommonConfig.js ├── mergeCustomConfig.js ├── transformLess.js ├── injectLoaderOptions.js ├── getWebpackCommonConfig.js └── build.js ├── assets ├── fail.png ├── warn.png └── success.png ├── .travis.yml ├── .gitignore ├── Makefile ├── .editorconfig ├── .eslintrc ├── bin └── atool-build ├── README.md ├── package.json └── HISTORY.md /test/fixtures/build-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | **/*/__tests__ 2 | **/*/__fixtures__ 3 | -------------------------------------------------------------------------------- /test/fixtures/build-autoprefix/index.js: -------------------------------------------------------------------------------- 1 | import './index.css'; -------------------------------------------------------------------------------- /test/fixtures/build-hash-map/index.js: -------------------------------------------------------------------------------- 1 | console.log(1); 2 | 3 | -------------------------------------------------------------------------------- /test/fixtures/build-normal/index.js: -------------------------------------------------------------------------------- 1 | console.log(1); 2 | 3 | -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/oo.js: -------------------------------------------------------------------------------- 1 | console.log('oo'); -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/xx.js: -------------------------------------------------------------------------------- 1 | console.log('oo'); -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-path/index.js: -------------------------------------------------------------------------------- 1 | console.log(1) -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-plugins/index.js: -------------------------------------------------------------------------------- 1 | console.log(1) -------------------------------------------------------------------------------- /test/fixtures/build-add-module-exports/a.js: -------------------------------------------------------------------------------- 1 | 2 | export default 1; 3 | -------------------------------------------------------------------------------- /test/fixtures/build-jsx/index.js: -------------------------------------------------------------------------------- 1 | 2 | ReactDOM.render(
a
); 3 | -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-babel/index.js: -------------------------------------------------------------------------------- 1 | console.log(1) 2 | -------------------------------------------------------------------------------- /test/fixtures/transformLess/b.less: -------------------------------------------------------------------------------- 1 | 2 | .b { 3 | color: red; 4 | } 5 | -------------------------------------------------------------------------------- /test/expect/build-theme/index.css: -------------------------------------------------------------------------------- 1 | button { 2 | color: #333333; 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/build-common/a.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | console.log('a'); -------------------------------------------------------------------------------- /test/fixtures/build-common/b.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | console.log('b'); -------------------------------------------------------------------------------- /test/fixtures/build-common/c.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | console.log('c'); -------------------------------------------------------------------------------- /test/fixtures/build-i18n/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "Hello World": "Hallo Welt" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/build-no-entry/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/build-svg/index.js: -------------------------------------------------------------------------------- 1 | import './index.less'; 2 | console.log(1); -------------------------------------------------------------------------------- /test/fixtures/build-theme/index.js: -------------------------------------------------------------------------------- 1 | console.log(1); 2 | require('./index.less'); -------------------------------------------------------------------------------- /src/webpack.js: -------------------------------------------------------------------------------- 1 | import webpack from 'webpack'; 2 | 3 | export default webpack; 4 | -------------------------------------------------------------------------------- /test/expect/build-common/common.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #ffffff; 3 | } -------------------------------------------------------------------------------- /test/fixtures/build-common/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #ffffff; 3 | } -------------------------------------------------------------------------------- /test/fixtures/build-font/index.js: -------------------------------------------------------------------------------- 1 | import './index.less'; 2 | import './index.html'; -------------------------------------------------------------------------------- /test/fixtures/build-node-builtins/index.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs' 2 | console.log(fs) -------------------------------------------------------------------------------- /test/fixtures/mergeCustomConfig-error/webpack.config.js: -------------------------------------------------------------------------------- 1 | 2 | export default []; 3 | -------------------------------------------------------------------------------- /assets/fail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ant-tool/atool-build/HEAD/assets/fail.png -------------------------------------------------------------------------------- /assets/warn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ant-tool/atool-build/HEAD/assets/warn.png -------------------------------------------------------------------------------- /test/fixtures/build-es3/index.js: -------------------------------------------------------------------------------- 1 | 2 | import { shout } from './a'; 3 | shout(); 4 | 5 | -------------------------------------------------------------------------------- /test/fixtures/build-json/index.js: -------------------------------------------------------------------------------- 1 | import pkg from './package.json' 2 | console.log(pkg) -------------------------------------------------------------------------------- /test/fixtures/build-less/index.js: -------------------------------------------------------------------------------- 1 | 2 | import './index.less'; 3 | console.log('1'); 4 | -------------------------------------------------------------------------------- /assets/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ant-tool/atool-build/HEAD/assets/success.png -------------------------------------------------------------------------------- /test/fixtures/build-add-module-exports/index.js: -------------------------------------------------------------------------------- 1 | import a from './a'; 2 | console.log(a); 3 | -------------------------------------------------------------------------------- /test/fixtures/build-svg/index.less: -------------------------------------------------------------------------------- 1 | .info{ 2 | background: url(./info.svg) no-repeat; 3 | } -------------------------------------------------------------------------------- /test/fixtures/build-es3/a.js: -------------------------------------------------------------------------------- 1 | 2 | export default { 3 | shout() { console.log('a'); } 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/node_modules/a/node_modules/c/index.js: -------------------------------------------------------------------------------- 1 | console.log('child-c'); -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/node_modules/b/node_modules/c/index.js: -------------------------------------------------------------------------------- 1 | console.log('child-c'); -------------------------------------------------------------------------------- /test/fixtures/build-es3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-jsx/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-environment-development/index.js: -------------------------------------------------------------------------------- 1 | console.log(process.env.NODE_ENV) -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-environment-production/index.js: -------------------------------------------------------------------------------- 1 | console.log(process.env.NODE_ENV) -------------------------------------------------------------------------------- /test/fixtures/build-svg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/transformLess/node_modules/external-package/c.less: -------------------------------------------------------------------------------- 1 | .c { 2 | color: yellow; 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/node_modules/a/index.js: -------------------------------------------------------------------------------- 1 | require('c'); 2 | console.log('child-a'); -------------------------------------------------------------------------------- /test/fixtures/build-font/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-i18n/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-less/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-normal/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-autoprefix/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-class-property/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./1.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-css-modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-decorator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-i18n/index.js: -------------------------------------------------------------------------------- 1 | 2 | console.log(__("Hello World")); 3 | console.log(__("Missing Text")); 4 | -------------------------------------------------------------------------------- /test/fixtures/build-less/index.less: -------------------------------------------------------------------------------- 1 | 2 | .index { 3 | color: red; 4 | transform: translateX(1); 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-node-builtins/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.tsx" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-add-module-exports/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-autoprefix/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | flex-direction:column; 3 | -webkit-flex-direction:column; 4 | } -------------------------------------------------------------------------------- /test/fixtures/build-common/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "a": "./a.js", 4 | "b": "./b.js" 5 | } 6 | } -------------------------------------------------------------------------------- /test/fixtures/build-theme/index.less: -------------------------------------------------------------------------------- 1 | @buttonTxtColor: #222222; 2 | 3 | button { 4 | color: @buttonTxtColor; 5 | } -------------------------------------------------------------------------------- /test/fixtures/build-css-modules/index.js: -------------------------------------------------------------------------------- 1 | 2 | import style from './index.module.less'; 3 | console.log(style.index); 4 | -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-babel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-path/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - "6" 5 | - "7" 6 | 7 | after_success: 8 | - npm run coveralls 9 | -------------------------------------------------------------------------------- /test/fixtures/build-font/webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ant-tool/atool-build/HEAD/test/fixtures/build-font/webfont.eot -------------------------------------------------------------------------------- /test/fixtures/build-font/webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ant-tool/atool-build/HEAD/test/fixtures/build-font/webfont.ttf -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-plugins/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/node_modules/b/index.js: -------------------------------------------------------------------------------- 1 | require('c'); 2 | console.log('child-a'); 3 | console.log('child-b'); -------------------------------------------------------------------------------- /test/fixtures/build-font/webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ant-tool/atool-build/HEAD/test/fixtures/build-font/webfont.woff -------------------------------------------------------------------------------- /test/fixtures/build-theme/antui-config.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return { 3 | '@buttonTxtColor': '#333333' 4 | }; 5 | }; -------------------------------------------------------------------------------- /test/expect/build-normal/map.json: -------------------------------------------------------------------------------- 1 | { 2 | "index.js": "index-9ef985f8fe74a50efc00.js", 3 | "common.js": "common-8d2b1e3a44d8c25d78f8.js" 4 | } -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-environment-development/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-environment-production/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/build-theme/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | }, 5 | "theme": "./antui-config.js" 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | tmp 4 | node_modules/* 5 | test/fixtures/**/dist 6 | coverage 7 | lib 8 | npm-debug.log 9 | *.lock 10 | -------------------------------------------------------------------------------- /test/expect/build-mergeCustomConfig-environment-production/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[function(o,c,n){"use strict";console.log("production")}],[0]); -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/index.js: -------------------------------------------------------------------------------- 1 | require('a'); 2 | require('b'); 3 | require('./oo'); 4 | require('./xx'); 5 | console.log('father'); -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-path/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(webpackConfig, environment) { 2 | return webpackConfig; 3 | } -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | publish: 3 | npm run build 4 | npm publish 5 | 6 | publish-sync: publish 7 | cnpm sync atool-build 8 | tnpm sync atool-build 9 | 10 | -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/node_modules/a/node_modules/c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "c", 3 | "version": "0.0.1", 4 | "main": "./index.js" 5 | } -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/node_modules/b/node_modules/c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "c", 3 | "version": "0.0.1", 4 | "main": "./index.js" 5 | } -------------------------------------------------------------------------------- /test/fixtures/build-hash-map/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "build-hash-map", 3 | "version": "0.0.1", 4 | "entry": { 5 | "index": "./index.js" 6 | } 7 | } -------------------------------------------------------------------------------- /src/dependencies.js: -------------------------------------------------------------------------------- 1 | export ExtractTextPlugin from 'extract-text-webpack-plugin'; 2 | export CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin'; 3 | -------------------------------------------------------------------------------- /test/fixtures/build-css-modules/index.module.less: -------------------------------------------------------------------------------- 1 | 2 | .index { 3 | color: red; 4 | display: flex; 5 | 6 | .foo { 7 | position: absolute 0; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-path/webpack.config.path.js: -------------------------------------------------------------------------------- 1 | module.exports = function(webpackConfig, environment) { 2 | webpackConfig.plugins = []; 3 | return webpackConfig; 4 | } -------------------------------------------------------------------------------- /test/expect/build-less/index.css: -------------------------------------------------------------------------------- 1 | .index { 2 | color: red; 3 | -webkit-transform: translateX(1); 4 | -ms-transform: translateX(1); 5 | transform: translateX(1); 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "index": "./index.js" 4 | }, 5 | "dependencies": { 6 | "a": "0.0.1", 7 | "b": "0.0.1" 8 | } 9 | } -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/node_modules/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a", 3 | "version": "0.0.1", 4 | "main": "./index.js", 5 | "dependencies": { 6 | "c": "0.0.1" 7 | } 8 | } -------------------------------------------------------------------------------- /test/fixtures/build-dedupePlugin-enabled/node_modules/b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "b", 3 | "version": "0.0.1", 4 | "main": "./index.js", 5 | "dependencies": { 6 | "c": "0.0.1" 7 | } 8 | } -------------------------------------------------------------------------------- /test/fixtures/build-decorator/index.js: -------------------------------------------------------------------------------- 1 | 2 | const calls = []; 3 | 4 | function dec(id){ 5 | calls.push(id); 6 | return function(){}; 7 | } 8 | 9 | @dec(1) 10 | class Example { 11 | } 12 | 13 | -------------------------------------------------------------------------------- /test/expect/build-hash-map/build-hash-map/0.0.1/map.json: -------------------------------------------------------------------------------- 1 | { 2 | "build-hash-map/index.js": "build-hash-map/index-9ef985f8fe74a50efc00.js", 3 | "build-hash-map/common.js": "build-hash-map/common-8d2b1e3a44d8c25d78f8.js" 4 | } -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-plugins/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(webpackConfig) { 2 | webpackConfig.output.filename = "[name].js"; 3 | webpackConfig.plugins = []; 4 | return webpackConfig; 5 | } -------------------------------------------------------------------------------- /test/expect/build-autoprefix/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | -webkit-box-orient:vertical; 3 | -webkit-box-direction:normal; 4 | -ms-flex-direction:column; 5 | flex-direction:column; 6 | -webkit-flex-direction:column; 7 | } -------------------------------------------------------------------------------- /src/getTSCommonConfig.js: -------------------------------------------------------------------------------- 1 | export default function ts() { 2 | return { 3 | target: 'es6', 4 | jsx: 'preserve', 5 | moduleResolution: 'node', 6 | declaration: false, 7 | sourceMap: true, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /test/expect/build-hash-map/build-hash-map/0.0.1/index-6ac733341b735e19fafd.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([1,0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports) { 4 | 5 | "use strict"; 6 | 7 | console.log(1); 8 | 9 | /***/ }) 10 | ]); -------------------------------------------------------------------------------- /test/expect/build-normal/index-9ef985f8fe74a50efc00.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | console.log(1); 9 | 10 | /***/ }) 11 | ],[0]); -------------------------------------------------------------------------------- /test/expect/build-mergeCustomConfig-babel/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | "use helloworld"; 9 | console.log(1); 10 | 11 | /***/ }) 12 | ],[0]); -------------------------------------------------------------------------------- /test/expect/build-common/b.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],{ 2 | 3 | /***/ 2: 4 | /***/ (function(module, exports, __webpack_require__) { 5 | 6 | "use strict"; 7 | 8 | 9 | __webpack_require__(0); 10 | 11 | console.log('b'); 12 | 13 | /***/ }) 14 | 15 | },[2]); -------------------------------------------------------------------------------- /test/expect/build-hash-map/build-hash-map/0.0.1/index-9ef985f8fe74a50efc00.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | console.log(1); 9 | 10 | /***/ }) 11 | ],[0]); -------------------------------------------------------------------------------- /test/expect/build-i18n/app.de.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | console.log("Hallo Welt"); 9 | console.log("Missing Text"); 10 | 11 | /***/ }) 12 | ],[0]); -------------------------------------------------------------------------------- /test/expect/build-i18n/app.en.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | console.log("Hello World"); 9 | console.log("Missing Text"); 10 | 11 | /***/ }) 12 | ],[0]); -------------------------------------------------------------------------------- /test/expect/build-common/a.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([1],[ 2 | /* 0 */, 3 | /* 1 */ 4 | /***/ (function(module, exports, __webpack_require__) { 5 | 6 | "use strict"; 7 | 8 | 9 | __webpack_require__(0); 10 | 11 | console.log('a'); 12 | 13 | /***/ }) 14 | ],[1]); -------------------------------------------------------------------------------- /test/expect/build-mergeCustomConfig-environment-development/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | console.log("development"); 9 | 10 | /***/ }) 11 | ],[0]); -------------------------------------------------------------------------------- /test/expect/build-jsx/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | ReactDOM.render(React.createElement( 9 | "div", 10 | null, 11 | "a" 12 | )); 13 | 14 | /***/ }) 15 | ],[0]); -------------------------------------------------------------------------------- /test/fixtures/build-typescript/index.tsx: -------------------------------------------------------------------------------- 1 | class Greeter { 2 | constructor(public greeting: string) {} 3 | greet() { 4 | return `

${this.greeting}

`; 5 | } 6 | } 7 | 8 | const greeter = new Greeter('Hello, world!'); 9 | document.body.innerHTML = greeter.greet(); 10 | -------------------------------------------------------------------------------- /test/fixtures/build-hash-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import pkg from './package.json'; 3 | 4 | export default function customConfig(webpackConfig) { 5 | webpackConfig.output.path = join(process.cwd(), 'dist', pkg.name, pkg.version); 6 | return webpackConfig; 7 | }; -------------------------------------------------------------------------------- /test/expect/build-class-property/1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/fixtures/build-class-property/1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/fixtures/mergeCustomConfig-function/webpack.config.js: -------------------------------------------------------------------------------- 1 | 2 | export default function customConfig(webpackConfig,environment) { 3 | if (environment === 'development') { 4 | webpackConfig.a = 'd'; 5 | } else { 6 | webpackConfig.a = 'p'; 7 | } 8 | 9 | return webpackConfig; 10 | }; 11 | -------------------------------------------------------------------------------- /test/expect/build-css-modules/index.css: -------------------------------------------------------------------------------- 1 | .index___1Xnek { 2 | color: red; 3 | display: -webkit-box; 4 | display: -webkit-flex; 5 | display: -ms-flexbox; 6 | display: flex; 7 | } 8 | .index___1Xnek .foo___26SGr { 9 | position: absolute; 10 | top: 0; 11 | right: 0; 12 | bottom: 0; 13 | left: 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/fixtures/transformLess/a.less: -------------------------------------------------------------------------------- 1 | @import "~external-package/c.less"; 2 | @import "./b.less"; 3 | 4 | @green: '#ccc'; 5 | 6 | .a { 7 | // less variable 8 | color: @green; 9 | 10 | // autoprefixer 11 | transform: translateX(1); 12 | 13 | // rucksack 14 | .foo { 15 | position: absolute 0; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [Makefile] 16 | indent_style = tab 17 | -------------------------------------------------------------------------------- /test/expect/build-autoprefix/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | __webpack_require__(1); 9 | 10 | /***/ }), 11 | /* 1 */ 12 | /***/ (function(module, exports) { 13 | 14 | // removed by extract-text-webpack-plugin 15 | 16 | /***/ }) 17 | ],[0]); -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint-config-airbnb/base", 3 | "parser": "babel-eslint", 4 | "env": { 5 | "mocha": true 6 | }, 7 | "rules": { 8 | "no-console": [0], 9 | "space-before-function-paren": [2, "never"], 10 | "max-len": [2, 120, 2], 11 | "global-require": [0], 12 | "import/no-dynamic-require": [0] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/expect/build-theme/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | console.log(1); 9 | __webpack_require__(1); 10 | 11 | /***/ }), 12 | /* 1 */ 13 | /***/ (function(module, exports) { 14 | 15 | // removed by extract-text-webpack-plugin 16 | 17 | /***/ }) 18 | ],[0]); -------------------------------------------------------------------------------- /test/expect/build-svg/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | __webpack_require__(1); 9 | 10 | console.log(1); 11 | 12 | /***/ }), 13 | /* 1 */ 14 | /***/ (function(module, exports) { 15 | 16 | // removed by extract-text-webpack-plugin 17 | 18 | /***/ }) 19 | ],[0]); -------------------------------------------------------------------------------- /test/expect/build-less/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | __webpack_require__(1); 9 | 10 | console.log('1'); 11 | 12 | /***/ }), 13 | /* 1 */ 14 | /***/ (function(module, exports) { 15 | 16 | // removed by extract-text-webpack-plugin 17 | 18 | /***/ }) 19 | ],[0]); -------------------------------------------------------------------------------- /test/expect/transformLess/a.css: -------------------------------------------------------------------------------- 1 | .c { 2 | color: yellow; 3 | } 4 | .b { 5 | color: red; 6 | } 7 | .a { 8 | color: '#ccc'; 9 | -webkit-transform: translateX(1); 10 | -ms-transform: translateX(1); 11 | transform: translateX(1); 12 | } 13 | .a .foo { 14 | position: absolute; 15 | top: 0; 16 | right: 0; 17 | bottom: 0; 18 | left: 0; 19 | } 20 | -------------------------------------------------------------------------------- /test/fixtures/build-mergeCustomConfig-babel/webpack.config.js: -------------------------------------------------------------------------------- 1 | function hello({ types: t }) { 2 | return { 3 | visitor: { 4 | Program(path) { 5 | path.unshiftContainer('body', t.expressionStatement(t.stringLiteral('use helloworld'))); 6 | }, 7 | }, 8 | }; 9 | } 10 | 11 | module.exports = function(webpackConfig) { 12 | webpackConfig.babel.plugins.push(hello); 13 | 14 | return webpackConfig; 15 | }; 16 | -------------------------------------------------------------------------------- /test/expect/build-font/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | webfont 5 | 8 | 9 | 10 | 11 | 12 | 13 |

webfont 字体预览

14 |

英雄不问出路,流氓不看岁数

15 | 16 | 17 | -------------------------------------------------------------------------------- /test/fixtures/build-font/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | webfont 5 | 8 | 9 | 10 | 11 | 12 | 13 |

webfont 字体预览

14 |

英雄不问出路,流氓不看岁数

15 | 16 | 17 | -------------------------------------------------------------------------------- /test/expect/build-node-builtins/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | var _fs = __webpack_require__(1); 9 | 10 | var _fs2 = _interopRequireDefault(_fs); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | console.log(_fs2.default); 15 | 16 | /***/ }), 17 | /* 1 */ 18 | /***/ (function(module, exports) { 19 | 20 | 21 | 22 | /***/ }) 23 | ],[0]); -------------------------------------------------------------------------------- /src/getBabelCommonConfig.js: -------------------------------------------------------------------------------- 1 | import { tmpdir } from 'os'; 2 | 3 | export default function babel() { 4 | return { 5 | cacheDirectory: tmpdir(), 6 | presets: [ 7 | require.resolve('babel-preset-es2015-ie'), 8 | require.resolve('babel-preset-react'), 9 | require.resolve('babel-preset-stage-0'), 10 | ], 11 | plugins: [ 12 | require.resolve('babel-plugin-add-module-exports'), 13 | require.resolve('babel-plugin-transform-decorators-legacy'), 14 | ], 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /test/fixtures/build-font/index.less: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'webfont'; 3 | src: url('webfont.eot'); 4 | src: url('webfont.eot?#iefix') format('embedded-opentype'), 5 | url('webfont.woff') format('woff'), 6 | url('webfont.ttf') format('truetype'); 7 | } 8 | 9 | .web-font{ 10 | font-family:"webfont" !important; 11 | font-size:16px; 12 | font-style:normal; 13 | -webkit-font-smoothing: antialiased; 14 | -webkit-text-stroke-width: 0.2px; 15 | -moz-osx-font-smoothing: grayscale; 16 | } -------------------------------------------------------------------------------- /test/expect/build-font/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | __webpack_require__(1); 9 | 10 | __webpack_require__(2); 11 | 12 | /***/ }), 13 | /* 1 */ 14 | /***/ (function(module, exports) { 15 | 16 | // removed by extract-text-webpack-plugin 17 | 18 | /***/ }), 19 | /* 2 */ 20 | /***/ (function(module, exports, __webpack_require__) { 21 | 22 | module.exports = __webpack_require__.p + "index.html"; 23 | 24 | /***/ }) 25 | ],[0]); -------------------------------------------------------------------------------- /test/expect/build-json/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | var _package = __webpack_require__(1); 9 | 10 | var _package2 = _interopRequireDefault(_package); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | console.log(_package2.default); 15 | 16 | /***/ }), 17 | /* 1 */ 18 | /***/ (function(module, exports) { 19 | 20 | module.exports = {"entry":{"index":"./index.js"}} 21 | 22 | /***/ }) 23 | ],[0]); -------------------------------------------------------------------------------- /test/fixtures/build-class-property/1.js: -------------------------------------------------------------------------------- 1 | import './1.html'; 2 | 3 | class Parent { 4 | constructor() { 5 | console.log('Parent constructor'); 6 | this.name = 'john'; 7 | } 8 | } 9 | 10 | class A extends Parent { 11 | constructor() { 12 | console.log('Child constructor'); 13 | super(); 14 | } 15 | 16 | static propTypes = 1; 17 | static method(obj) { 18 | console.log('method', obj); 19 | } 20 | 21 | foo() { 22 | console.log('foo', this.name); 23 | } 24 | } 25 | 26 | const a = new A(); 27 | a.foo(); 28 | A.method('haha'); 29 | 30 | 31 | -------------------------------------------------------------------------------- /test/transformLess-test.js: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { readFileSync } from 'fs'; 3 | import expect from 'expect'; 4 | import transformLess from '../src/transformLess'; 5 | 6 | const cwd = process.cwd(); 7 | 8 | describe('lib/transformLess', () => { 9 | it('should build normally', () => { 10 | return transformLess('./test/fixtures/transformLess/a.less', { cwd }) 11 | .then(result => { 12 | const expected = readFileSync(join(cwd, './test/expect/transformLess/a.css'), 'utf-8') 13 | expect(result).toEqual(expected); 14 | }); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /test/expect/build-es3/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | var _a = __webpack_require__(1); 9 | 10 | (0, _a.shout)(); 11 | 12 | /***/ }), 13 | /* 1 */ 14 | /***/ (function(module, exports, __webpack_require__) { 15 | 16 | "use strict"; 17 | 18 | 19 | Object.defineProperty(exports, "__esModule", { 20 | value: true 21 | }); 22 | exports.default = { 23 | shout: function shout() { 24 | console.log('a'); 25 | } 26 | }; 27 | module.exports = exports['default']; 28 | 29 | /***/ }) 30 | ],[0]); -------------------------------------------------------------------------------- /test/fixtures/build-i18n/webpack.config.js: -------------------------------------------------------------------------------- 1 | 2 | var I18nPlugin = require("i18n-webpack-plugin"); 3 | 4 | var langs = { 5 | "en": null, 6 | "de": require("./de.json") 7 | }; 8 | 9 | module.exports = function(webpackConfig) { 10 | return Object.keys(langs).map(function(lang) { 11 | return Object.assign({}, webpackConfig, { 12 | name: lang, 13 | output: Object.assign({}, webpackConfig.output, { 14 | filename: 'app.' + lang + '.js', 15 | }), 16 | plugins: [].concat(webpackConfig.plugins, new I18nPlugin( 17 | langs[lang] 18 | )), 19 | }); 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /test/expect/build-decorator/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | var _dec, _class; 9 | 10 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11 | 12 | var calls = []; 13 | 14 | function dec(id) { 15 | calls.push(id); 16 | return function () {}; 17 | } 18 | 19 | var Example = (_dec = dec(1), _dec(_class = function Example() { 20 | _classCallCheck(this, Example); 21 | }) || _class); 22 | 23 | /***/ }) 24 | ],[0]); -------------------------------------------------------------------------------- /test/expect/build-css-modules/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | var _indexModule = __webpack_require__(1); 9 | 10 | var _indexModule2 = _interopRequireDefault(_indexModule); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | console.log(_indexModule2.default.index); 15 | 16 | /***/ }), 17 | /* 1 */ 18 | /***/ (function(module, exports) { 19 | 20 | // removed by extract-text-webpack-plugin 21 | module.exports = {"index":"index___1Xnek","foo":"foo___26SGr"}; 22 | 23 | /***/ }) 24 | ],[0]); -------------------------------------------------------------------------------- /src/mergeCustomConfig.js: -------------------------------------------------------------------------------- 1 | import { existsSync } from 'fs'; 2 | 3 | /** 4 | * Merge custom config from `webpack.config.js`. 5 | * @param webpackConfig {Object} 6 | * @param customConfigPath {String} 7 | */ 8 | export default function mergeCustomConfig(webpackConfig, customConfigPath) { 9 | if (!existsSync(customConfigPath)) { 10 | return webpackConfig; 11 | } 12 | 13 | const customConfig = require(customConfigPath); 14 | /* eslint prefer-rest-params:0 */ 15 | if (typeof customConfig === 'function') { 16 | return customConfig(webpackConfig, ...[...arguments].slice(2)); 17 | } 18 | 19 | throw new Error(`Return of ${customConfigPath} must be a function.`); 20 | } 21 | -------------------------------------------------------------------------------- /test/expect/build-add-module-exports/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | var _a = __webpack_require__(1); 9 | 10 | var _a2 = _interopRequireDefault(_a); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | console.log(_a2.default); 15 | 16 | /***/ }), 17 | /* 1 */ 18 | /***/ (function(module, exports, __webpack_require__) { 19 | 20 | "use strict"; 21 | 22 | 23 | Object.defineProperty(exports, "__esModule", { 24 | value: true 25 | }); 26 | exports.default = 1; 27 | module.exports = exports["default"]; 28 | 29 | /***/ }) 30 | ],[0]); -------------------------------------------------------------------------------- /test/expect/build-typescript/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9 | 10 | var Greeter = function () { 11 | function Greeter(greeting) { 12 | _classCallCheck(this, Greeter); 13 | 14 | this.greeting = greeting; 15 | } 16 | 17 | Greeter.prototype.greet = function greet() { 18 | return '

' + this.greeting + '

'; 19 | }; 20 | 21 | return Greeter; 22 | }(); 23 | 24 | var greeter = new Greeter('Hello, world!'); 25 | document.body.innerHTML = greeter.greet(); 26 | 27 | /***/ }) 28 | ],[0]); -------------------------------------------------------------------------------- /test/mergeCustomConfig-test.js: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import mergeCustomConfig from '../src/mergeCustomConfig'; 3 | import expect from 'expect'; 4 | 5 | describe('lib/mergeCustomConfig', () => { 6 | 7 | it('should not replace if no config', () => { 8 | const baseDir = join(__dirname, 'fixtures/not-found'); 9 | const customConfigPath = join(baseDir,'webpack.config.js'); 10 | expect(mergeCustomConfig({a:1}, customConfigPath)).toEqual({a:1}); 11 | }); 12 | 13 | it('should replace if function', () => { 14 | const baseDir = join(__dirname, 'fixtures/mergeCustomConfig-function'); 15 | const customConfigPath = join(baseDir,'webpack.config.js'); 16 | expect(mergeCustomConfig({a:1}, customConfigPath)).toEqual({a:'p'}); 17 | expect(mergeCustomConfig({a:1}, customConfigPath, 'development')).toEqual({a:'d'}); 18 | }); 19 | 20 | it('should throw error if not function', () => { 21 | const baseDir = join(__dirname, 'fixtures/mergeCustomConfig-error'); 22 | const customConfigPath = join(baseDir,'webpack.config.js'); 23 | expect(() => { 24 | mergeCustomConfig({a:1}, customConfigPath); 25 | }).toThrow(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /test/expect/build-dedupePlugin-enabled/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | __webpack_require__(1); 9 | __webpack_require__(3); 10 | __webpack_require__(5); 11 | __webpack_require__(6); 12 | console.log('father'); 13 | 14 | /***/ }), 15 | /* 1 */ 16 | /***/ (function(module, exports, __webpack_require__) { 17 | 18 | __webpack_require__(2); 19 | console.log('child-a'); 20 | 21 | /***/ }), 22 | /* 2 */ 23 | /***/ (function(module, exports) { 24 | 25 | console.log('child-c'); 26 | 27 | /***/ }), 28 | /* 3 */ 29 | /***/ (function(module, exports, __webpack_require__) { 30 | 31 | __webpack_require__(4); 32 | console.log('child-a'); 33 | console.log('child-b'); 34 | 35 | /***/ }), 36 | /* 4 */ 37 | /***/ (function(module, exports) { 38 | 39 | console.log('child-c'); 40 | 41 | /***/ }), 42 | /* 5 */ 43 | /***/ (function(module, exports, __webpack_require__) { 44 | 45 | "use strict"; 46 | 47 | 48 | console.log('oo'); 49 | 50 | /***/ }), 51 | /* 6 */ 52 | /***/ (function(module, exports, __webpack_require__) { 53 | 54 | "use strict"; 55 | 56 | 57 | console.log('oo'); 58 | 59 | /***/ }) 60 | ],[0]); -------------------------------------------------------------------------------- /test/fixtures/build-svg/info.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/expect/build-mergeCustomConfig-environment-production/common.js: -------------------------------------------------------------------------------- 1 | !function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,i){for(var u,a,f,l=0,s=[];l', 'output path') 9 | .option('-w, --watch [delay]', 'watch file changes and rebuild') 10 | .option('--hash', 'build with hash and output map.json') 11 | .option('--publicPath ', 'publicPath for webpack') 12 | .option('--devtool ', 'sourcemap generate method, default is null') 13 | .option('--config ', 'custom config path, default is webpack.config.js') 14 | .option('--no-compress', 'build without compress') 15 | .option('--silent', 'close notifier') 16 | .option('--notify', 'activates notifications for build results') 17 | .option('--json', 'running webpack with --json, ex. result.json') 18 | .option('--verbose', 'run with more logging messages.') 19 | .parse(process.argv); 20 | 21 | program.cwd = process.cwd(); 22 | 23 | if (program.silent === true) { 24 | console.warn(chalk.yellow('warning: "--silent" has been deprecated in favor of "--notify"')); 25 | } 26 | 27 | if (program.watch) { 28 | require('../lib/build')(program); 29 | } else { 30 | require('../lib/build')(program, function (err) { 31 | if (err) { 32 | console.error(err); 33 | process.exit(1); 34 | } 35 | process.exit(0); 36 | }); 37 | } 38 | 39 | require('atool-monitor').emit(); 40 | -------------------------------------------------------------------------------- /src/transformLess.js: -------------------------------------------------------------------------------- 1 | import less from 'less'; 2 | import { readFileSync } from 'fs'; 3 | import path, { dirname } from 'path'; 4 | import postcss from 'postcss'; 5 | import rucksack from 'rucksack-css'; 6 | import autoprefixer from 'autoprefixer'; 7 | import NpmImportPlugin from 'less-plugin-npm-import'; 8 | 9 | function transformLess(lessFile, config = {}) { 10 | const { cwd = process.cwd() } = config; 11 | const resolvedLessFile = path.resolve(cwd, lessFile); 12 | 13 | let data = readFileSync(resolvedLessFile, 'utf-8'); 14 | data = data.replace(/^\uFEFF/, ''); 15 | 16 | return new Promise((resolve, reject) => { 17 | // Do less compile 18 | const lessOpts = { 19 | paths: [dirname(resolvedLessFile)], 20 | filename: resolvedLessFile, 21 | plugins: [ 22 | new NpmImportPlugin({ prefix: '~' }), 23 | ], 24 | }; 25 | less.render(data, lessOpts) 26 | .then((result) => { 27 | // Do postcss compile 28 | const plugins = [ 29 | rucksack(), 30 | autoprefixer({ 31 | browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 8'], 32 | }), 33 | ]; 34 | const source = result.css; 35 | const postcssOpts = {}; 36 | 37 | postcss(plugins).process(source, postcssOpts) 38 | .then((r) => { 39 | resolve(r.css); 40 | }) 41 | .catch((err) => { 42 | reject(err); 43 | }); 44 | }) 45 | .catch((err) => { 46 | reject(err); 47 | }); 48 | }); 49 | } 50 | 51 | export default transformLess; 52 | -------------------------------------------------------------------------------- /test/expect/build-svg/index.css: -------------------------------------------------------------------------------- 1 | .info { 2 | background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE3LjAuMiwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB3aWR0aD0iNDRweCIgaGVpZ2h0PSI0NHB4IiB2aWV3Qm94PSIwIDAgNDQgNDQiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDQ0IDQ0IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGc+Cgk8Y2lyY2xlIGN4PSIxMy44MjgiIGN5PSIxOS42MyIgcj0iMS45MzgiLz4KCTxjaXJjbGUgY3g9IjIxLjc2NyIgY3k9IjE5LjYzIiByPSIxLjkzOCIvPgoJPGNpcmNsZSBjeD0iMjkuNzY3IiBjeT0iMTkuNjMiIHI9IjEuOTM4Ii8+Cgk8cGF0aCBkPSJNMjIuMTAyLDQuMTYxYy05LjkxOCwwLTE3Ljk1OCw3LjE0Ni0xNy45NTgsMTUuOTYxYzAsNC45MzUsMi41MjIsOS4zNDUsNi40ODEsMTIuMjczdjUuNjY3bDAuMDM4LDAuMDEyCgkJYzAuMTgyLDEuMjgsMS4yNzIsMi4yNjcsMi42MDIsMi4yNjdjMC43NDcsMCwxLjQxOS0wLjMxMywxLjg5OS0wLjgxMmwwLjAwMiwwLjAwMWw1LjAyNi0zLjUzOQoJCWMwLjYyOCwwLjA1OSwxLjI2NSwwLjA5MywxLjkxMSwwLjA5M2M5LjkxOCwwLDE3Ljk1OC03LjE0NiwxNy45NTgtMTUuOTYxQzQwLjA2LDExLjMwNywzMi4wMiw0LjE2MSwyMi4xMDIsNC4xNjF6IE0yMi4wNjIsMzQuMDYyCgkJYy0wLjkwMiwwLTEuNzgxLTAuMDgxLTIuNjQyLTAuMjA3bC01Ljg4Miw0LjIzNGMtMC4wMjQsMC4wMjUtMC4wNTUsMC4wNC0wLjA4MywwLjA2bC0wLjAwOCwwLjAwNmwwLDAKCQljLTAuMDgzLDAuMDU1LTAuMTc3LDAuMDk1LTAuMjg0LDAuMDk1Yy0wLjI5LDAtMC41MjUtMC4yMzUtMC41MjUtMC41MjVsMC4wMDUtNi4zNzVjLTMuOTEtMi41MTYtNi40NTYtNi41NDQtNi40NTYtMTEuMQoJCWMwLTcuNjI4LDcuMTA3LTEzLjgxMiwxNS44NzUtMTMuODEyczE1Ljg3NSw2LjE4NCwxNS44NzUsMTMuODEyUzMwLjgzLDM0LjA2MiwyMi4wNjIsMzQuMDYyeiIvPgo8L2c+Cjwvc3ZnPgo=) no-repeat; 3 | } 4 | -------------------------------------------------------------------------------- /test/expect/build-class-property/index.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],[ 2 | /* 0 */ 3 | /***/ (function(module, exports, __webpack_require__) { 4 | 5 | "use strict"; 6 | 7 | 8 | var _class, _temp; 9 | 10 | __webpack_require__(1); 11 | 12 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } 13 | 14 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 15 | 16 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } 17 | 18 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 19 | 20 | var Parent = function Parent() { 21 | _classCallCheck(this, Parent); 22 | 23 | console.log('Parent constructor'); 24 | this.name = 'john'; 25 | }; 26 | 27 | var A = (_temp = _class = function (_Parent) { 28 | _inherits(A, _Parent); 29 | 30 | function A() { 31 | _classCallCheck(this, A); 32 | 33 | console.log('Child constructor'); 34 | return _possibleConstructorReturn(this, _Parent.call(this)); 35 | } 36 | 37 | A.method = function method(obj) { 38 | console.log('method', obj); 39 | }; 40 | 41 | A.prototype.foo = function foo() { 42 | console.log('foo', this.name); 43 | }; 44 | 45 | return A; 46 | }(Parent), _class.propTypes = 1, _temp); 47 | 48 | 49 | var a = new A(); 50 | a.foo(); 51 | A.method('haha'); 52 | 53 | /***/ }), 54 | /* 1 */ 55 | /***/ (function(module, exports, __webpack_require__) { 56 | 57 | module.exports = __webpack_require__.p + "1.html"; 58 | 59 | /***/ }) 60 | ],[0]); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # atool-build 2 | 3 | [![NPM version](https://img.shields.io/npm/v/atool-build.svg?style=flat)](https://npmjs.org/package/atool-build) 4 | [![Build Status](https://img.shields.io/travis/ant-tool/atool-build.svg?style=flat)](https://travis-ci.org/ant-tool/atool-build) 5 | [![Coverage Status](https://img.shields.io/coveralls/ant-tool/atool-build.svg?style=flat)](https://coveralls.io/r/ant-tool/atool-build) 6 | [![NPM downloads](http://img.shields.io/npm/dm/atool-build.svg?style=flat)](https://npmjs.org/package/atool-build) 7 | [![Dependency Status](https://david-dm.org/ant-tool/atool-build.svg)](https://david-dm.org/ant-tool/atool-build) 8 | 9 | 基于 webpack 的构建封装. 10 | 11 | ---- 12 | 13 | ## 特性 14 | 15 | - 基于 webpack 实现 16 | - 支持通过 `webpack.config.js` 进行扩展 webpack 的配置项 17 | - 支持 [stage-0](https://babeljs.io/docs/plugins/preset-stage-0), [es2015](https://babeljs.io/docs/plugins/preset-es2015), react 和 less 18 | - 支持 hash 模式的构建, 并生成映射表 `map.json` 19 | - 支持 typescript 20 | 21 | ## 安装 22 | 23 | ```bash 24 | $ npm i atool-build --save 25 | ``` 26 | 27 | ## 使用 28 | 29 | ```bash 30 | $ atool-build [options] 31 | ``` 32 | 33 | ### 命令行参数 34 | 35 | ```bash 36 | $ atool-build -h 37 | 38 | Usage: atool-build [options] 39 | 40 | Options: 41 | 42 | -h, --help output usage information 43 | -v, --version output the version number 44 | -o, --output-path output path 45 | -w, --watch [delay] watch file changes and rebuild 46 | --hash build with hash and output map.json 47 | --publicPath webpack publicPath 48 | --devtool sourcemap generate method, default is null 49 | --config custom config path, default is webpack.config.js 50 | --no-compress build without compress 51 | --silent build without notify 52 | ``` 53 | 54 | ### 配置扩展 55 | 56 | 如果需要对内置的 webpack 配置进行修改, 可在项目根目录新建 `webpack.config.js` 进行扩展. 57 | 58 | 59 | 让 `webpack.config.js` 输出 `Function`, 比如: 60 | 61 | ```javascript 62 | var path = require("path"); 63 | module.exports = function(webpackConfig) { 64 | webpackConfig.output.path = path.join(__dirname, './public'); 65 | return webpackConfig; 66 | }; 67 | ``` 68 | 69 | 参数: 70 | 71 | - `webpackConfig` -- 默认配置, 修改后返回新的配置 72 | 73 | 74 | 详细内容:[atool-build 基本使用](http://ant-tool.github.io/atool-build.html) 75 | 76 | 77 | ## FAQ 78 | 79 | > 如何在 webpack.config.js 中引用 webpack ? (新增插件需要) 80 | 81 | `var webpack = require('atool-build/lib/webpack');` 82 | 83 | [#32](https://github.com/ant-tool/atool-build/issues/32) 84 | 85 | > 为什么 TypeScript 错误不会显示? 86 | 87 | 自行添加 [fork-ts-checker-webpack-plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin) 88 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "atool-build", 3 | "version": "2.0.0-alpha.12", 4 | "description": "Build tool based on webpack", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/ant-tool/atool-build" 8 | }, 9 | "homepage": "https://github.com/ant-tool/atool-build", 10 | "author": "chencheng ", 11 | "license": "MIT", 12 | "bin": { 13 | "atool-build": "./bin/atool-build" 14 | }, 15 | "files": [ 16 | "bin", 17 | "lib", 18 | "assets" 19 | ], 20 | "scripts": { 21 | "build": "rm -rf lib && babel src --out-dir lib", 22 | "test": "babel-node $(npm bin)/babel-istanbul cover $(npm bin)/_mocha -- --no-timeouts", 23 | "debug": "$(npm bin)/mocha --require babel-core/register --no-timeouts", 24 | "coveralls": "cat ./coverage/lcov.info | coveralls", 25 | "lint": "eslint --ext .js src", 26 | "pub": "npm run build && npm publish && rm -rf lib && git push origin" 27 | }, 28 | "pre-commit": [ 29 | "lint" 30 | ], 31 | "dependencies": { 32 | "atool-monitor": "0.x", 33 | "autoprefixer": "^7.1.4", 34 | "babel-core": "^6.24.1", 35 | "babel-loader": "^7.1.2", 36 | "babel-plugin-add-module-exports": "~0.2.1", 37 | "babel-plugin-transform-decorators-legacy": "^1.3.4", 38 | "babel-preset-es2015-ie": "^6.7.0", 39 | "babel-preset-react": "^6.24.1", 40 | "babel-preset-stage-0": "^6.24.1", 41 | "case-sensitive-paths-webpack-plugin": "^2.0.0", 42 | "chalk": "^2.1.0", 43 | "commander": "~2.11.0", 44 | "css-loader": "~0.28.0", 45 | "extract-text-webpack-plugin": "^3.0.0", 46 | "file-loader": "~0.11.1", 47 | "friendly-errors-webpack-plugin": "^1.6.1", 48 | "json-loader": "~0.5.4", 49 | "less": "~2.7.2", 50 | "less-loader": "~4.0.5", 51 | "less-plugin-npm-import": "^2.1.0", 52 | "map-json-webpack-plugin": "~1.2.0", 53 | "node-notifier": "^5.1.2", 54 | "postcss": "^6.0.11", 55 | "postcss-loader": "~2.0.6", 56 | "rucksack-css": "~1.0.2", 57 | "ts-loader": "^2.0.3", 58 | "typescript": "^2.2.2", 59 | "url-loader": "~0.5.8", 60 | "webpack": "^3.6.0" 61 | }, 62 | "devDependencies": { 63 | "babel-cli": "^6.24.1", 64 | "babel-core": "^6.24.1", 65 | "babel-eslint": "^8.0.0", 66 | "babel-istanbul": "^0.12.2", 67 | "babel-plugin-hello-world": "^1.0.0", 68 | "coveralls": "~2.13.0", 69 | "eslint": "^4.7.1", 70 | "eslint-config-airbnb": "^15.1.0", 71 | "eslint-plugin-import": "^2.2.0", 72 | "expect": "^21.1.0", 73 | "glob": "^7.1.1", 74 | "i18n-webpack-plugin": "^1.0.0", 75 | "mocha": "^3.2.0", 76 | "pre-commit": "~1.2.2" 77 | }, 78 | "babel": { 79 | "presets": [ 80 | "es2015-ie", 81 | "stage-0" 82 | ], 83 | "plugins": [ 84 | "add-module-exports" 85 | ] 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /test/expect/build-mergeCustomConfig-path/index.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 0); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */ 68 | /***/ (function(module, exports, __webpack_require__) { 69 | 70 | "use strict"; 71 | 72 | 73 | console.log(1); 74 | 75 | /***/ }) 76 | /******/ ]); -------------------------------------------------------------------------------- /test/expect/build-mergeCustomConfig-plugins/index.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 0); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */ 68 | /***/ (function(module, exports, __webpack_require__) { 69 | 70 | "use strict"; 71 | 72 | 73 | console.log(1); 74 | 75 | /***/ }) 76 | /******/ ]); -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | # History 2 | 3 | --- 4 | 5 | ## 1.0.0 6 | 7 | - feature: silent for notification https://github.com/ant-tool/atool-build/pull/303 8 | 9 | ## 0.11.1 10 | 11 | - enhancement: throw a message when webpack entry is empty 12 | 13 | ## 0.11.0 14 | 15 | - feat: friendly error https://github.com/ant-tool/atool-build/pull/271 16 | - fix: lint error https://github.com/ant-tool/atool-build/pull/272 17 | 18 | ## 0.10.1 19 | 20 | - `revert`: 回滚 svg-sprite-loader 21 | - `test`: 补充用例 svg 和 common 22 | 23 | ## 0.10.0 24 | 25 | - `breaking`: 在 watch 模式下关闭 UglifyJsPlugin 和 DedupePlugin ,如果开启则会引起调试时不可预测的诡异问题。[#265](https://github.com/ant-tool/atool-build/issues/265) 26 | - `breaking`: 使用 url-loader 来处理 `eot` 字体文件(之前是 file-loader),并新增相关用例。https://github.com/ant-tool/atool-build/pull/266
 27 | - `breaking`: 不再支持 node@6 以下,官方不再检查相关兼容性 https://github.com/ant-tool/atool-build/commit/5ccfca937c6353419ee1634666760714151ca8e2
 28 | - `feat`: 新增 svg-sprite-loader 来处理 svg sprite 需求,应用规则为 `*.icon.svg` 29 | - `feat`: 新增 case-sensitive-paths-webpack-plugin 避免在不同 os 平台下对 case 大小写支持问题
 https://github.com/ant-tool/atool-build/pull/251 30 | - `feat`: 新增 denpendices.js 导出 atool-build 内置的依赖,诸如: ExtractTextPlugin https://github.com/ant-tool/atool-build/pull/264 31 | - `deps`: 升级所有 atool-build 内置依赖(包含 webpack 升级至 1.15.0 - 1 分支中最新版本)并逐个过了相关用例 https://github.com/ant-tool/atool-build/pull/263 32 | - `fix`: 修复 ts 用例 https://github.com/ant-tool/atool-build/commit/83cccdaa9bdcf928c2ac712b5bceae6a328d05e5 33 | - `test`: 新增 autoprefix 相关用例 https://github.com/ant-tool/atool-build/pull/267 34 | 35 | ## 0.9.0 36 | 37 | - upgrade typescript to 2. Ref. #221 38 | 39 | ## 0.8.1 40 | 41 | - fix: css minimize bug with postcss plugin autoprefix and postcss-loader not found. Ref. #212 42 | 43 | ## 0.8.0 44 | 45 | - enhance autoprefix for mobile. Ref. #190 46 | 47 | ## 0.7.17 48 | 49 | - support import less by transformLess, Ref. [pr](https://github.com/ant-tool/atool-build/pull/188) 50 | 51 | ## 0.7.16 52 | 53 | - adding ".json" to the extensions under resolve 54 | - fix cwd 55 | - upgrade babel-* version 56 | 57 | ## 0.7.15 58 | 59 | - enhancement theme 60 | 61 | ## 0.7.14 62 | 63 | - add cacheDirectory, Close https://github.com/ant-design/antd-init/issues/78 64 | - support theme config, Close #176 65 | 66 | ## 0.7.13 67 | 68 | - fix: args.config is absolute path 69 | - fix: test error 70 | 71 | ## 0.7.6 72 | 73 | - compatibility: 0.7.4 before about babelQuery 74 | 75 | ## 0.7.5 76 | 77 | - support: typescript 78 | - fix: process exit when watch 79 | 80 | ## 0.7.4 81 | 82 | - fix: when build is done but process does not exit, Close #165 83 | 84 | ## 0.7.3 85 | 86 | - support: .web.js 87 | 88 | ## 0.7.2 89 | 90 | - fix: should check package.json before require it 91 | 92 | ## 0.7.1 93 | 94 | - fix class inherit problem in IE9 and IE10, #126, #148 95 | - remove typecheck plugin, #149 96 | 97 | ## 0.7.0 98 | 99 | - add lib/transformLess 100 | 101 | ## 0.6.0 102 | 103 | - 构建日志不输出 uglifyjs 的 warning 信息,#50 104 | - 修改 babel 和 UglifyJsPluginConfig 配置更简单,直接通过 `webpackConfig.babel` 调用,#58 105 | - js 里 require 的 html 文件会被复制到输出目录,#53 106 | - 通过匹配 `*.module.css` 支持 `css-modules`,一种更好的 css 组织方式 107 | - 添加 NoErrorsPlugin 插件,构建出错时不生成文件 108 | - 支持 rucksack,详见 http://simplaio.github.io/rucksack/ 109 | - 支持 webpackConfig 处理了 i18n 后是数组的场景,#98 110 | - watch 模式下精简日志信息,#86 111 | - 支持 decorator,#65 112 | 113 | ## 0.5.0 114 | 115 | 采用 postcss-loader 116 | 117 | 解决 map.json bug 118 | 119 | ## 0.4.3 120 | 121 | jsx 全部转换 122 | 123 | ## 0.4.0 124 | 125 | 更新 webpack 相关依赖 126 | 127 | ## 0.3.0 128 | 129 | 支持 less 变量 130 | 131 | ## 0.2.0 132 | 133 | react 不 external 了 134 | 135 | ## 0.1.0 136 | 137 | 初始版本 138 | 139 | -------------------------------------------------------------------------------- /test/expect/build-hash-map/build-hash-map/0.0.1/common-64056faf0c20a36e10a6.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, callbacks = []; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) 11 | /******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); 12 | /******/ installedChunks[chunkId] = 0; 13 | /******/ } 14 | /******/ for(moduleId in moreModules) { 15 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 16 | /******/ modules[moduleId] = moreModules[moduleId]; 17 | /******/ } 18 | /******/ } 19 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); 20 | /******/ while(callbacks.length) 21 | /******/ callbacks.shift().call(null, __webpack_require__); 22 | /******/ if(moreModules[0]) { 23 | /******/ installedModules[0] = 0; 24 | /******/ return __webpack_require__(0); 25 | /******/ } 26 | /******/ }; 27 | 28 | /******/ // The module cache 29 | /******/ var installedModules = {}; 30 | 31 | /******/ // object to store loaded and loading chunks 32 | /******/ // "0" means "already loaded" 33 | /******/ // Array means "loading", array contains callbacks 34 | /******/ var installedChunks = { 35 | /******/ 0:0 36 | /******/ }; 37 | 38 | /******/ // The require function 39 | /******/ function __webpack_require__(moduleId) { 40 | 41 | /******/ // Check if module is in cache 42 | /******/ if(installedModules[moduleId]) 43 | /******/ return installedModules[moduleId].exports; 44 | 45 | /******/ // Create a new module (and put it into the cache) 46 | /******/ var module = installedModules[moduleId] = { 47 | /******/ exports: {}, 48 | /******/ id: moduleId, 49 | /******/ loaded: false 50 | /******/ }; 51 | 52 | /******/ // Execute the module function 53 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 54 | 55 | /******/ // Flag the module as loaded 56 | /******/ module.loaded = true; 57 | 58 | /******/ // Return the exports of the module 59 | /******/ return module.exports; 60 | /******/ } 61 | 62 | /******/ // This file contains only the entry chunk. 63 | /******/ // The chunk loading function for additional chunks 64 | /******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { 65 | /******/ // "0" is the signal for "already loaded" 66 | /******/ if(installedChunks[chunkId] === 0) 67 | /******/ return callback.call(null, __webpack_require__); 68 | 69 | /******/ // an array means "currently loading". 70 | /******/ if(installedChunks[chunkId] !== undefined) { 71 | /******/ installedChunks[chunkId].push(callback); 72 | /******/ } else { 73 | /******/ // start chunk loading 74 | /******/ installedChunks[chunkId] = [callback]; 75 | /******/ var head = document.getElementsByTagName('head')[0]; 76 | /******/ var script = document.createElement('script'); 77 | /******/ script.type = 'text/javascript'; 78 | /******/ script.charset = 'utf-8'; 79 | /******/ script.async = true; 80 | 81 | /******/ script.src = __webpack_require__.p + "" + ({"1":"index"}[chunkId]||chunkId) + "-" + {"1":"6ac733341b735e19fafd"}[chunkId] + ".js"; 82 | /******/ head.appendChild(script); 83 | /******/ } 84 | /******/ }; 85 | 86 | /******/ // expose the modules object (__webpack_modules__) 87 | /******/ __webpack_require__.m = modules; 88 | 89 | /******/ // expose the module cache 90 | /******/ __webpack_require__.c = installedModules; 91 | 92 | /******/ // __webpack_public_path__ 93 | /******/ __webpack_require__.p = ""; 94 | /******/ }) 95 | /************************************************************************/ 96 | /******/ ([]); -------------------------------------------------------------------------------- /test/build-test.js: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { readFileSync } from 'fs'; 3 | import glob from 'glob'; 4 | import build from '../src/build'; 5 | import expect from 'expect'; 6 | 7 | function assert(actualDir, _expect) { 8 | const expectDir = join(__dirname, 'expect', _expect); 9 | const actualFiles = glob.sync('**/*', { cwd: actualDir, nodir: true }); 10 | 11 | actualFiles.forEach(file => { 12 | const actualFile = readFileSync(join(actualDir, file), 'utf-8'); 13 | const expectFile = readFileSync(join(expectDir, file), 'utf-8'); 14 | expect(actualFile).toEqual(expectFile); 15 | }); 16 | } 17 | 18 | function testBuild(args, fixture) { 19 | return new Promise(resolve => { 20 | const cwd = join(__dirname, 'fixtures', fixture); 21 | const outputPath = join(cwd, 'dist'); 22 | process.chdir(cwd); 23 | 24 | const defaultConfig = { 25 | cwd, 26 | compress: false, 27 | }; 28 | 29 | build({...defaultConfig, ...args}, err => { 30 | if (err) throw new Error(err); 31 | assert(outputPath, fixture); 32 | resolve(); 33 | }); 34 | }); 35 | } 36 | 37 | describe('lib/build', function () { 38 | this.timeout(50000); 39 | it('should build normally', () => { 40 | return testBuild({hash:true}, 'build-normal'); 41 | }); 42 | it('should support class property', () => { 43 | return testBuild({}, 'build-class-property'); 44 | }); 45 | it('should support less', () => { 46 | return testBuild({}, 'build-less'); 47 | }); 48 | it('should support css modules', () => { 49 | return testBuild({}, 'build-css-modules'); 50 | }); 51 | it('should support add-module-exports', () => { 52 | return testBuild({}, 'build-add-module-exports'); 53 | }); 54 | it('should support jsx', () => { 55 | return testBuild({}, 'build-jsx'); 56 | }); 57 | it('should support json', () => { 58 | return testBuild({}, 'build-json'); 59 | }); 60 | it('should support node builtins', () => { 61 | return testBuild({}, 'build-node-builtins'); 62 | }); 63 | it('should support mergeCustomConfig plugins', () => { 64 | return testBuild({hash:true}, 'build-mergeCustomConfig-plugins'); 65 | }); 66 | it('should support mergeCustomConfig environment production', () => { 67 | return testBuild({compress:true}, 'build-mergeCustomConfig-environment-production'); 68 | }); 69 | it('should support mergeCustomConfig environment development', () => { 70 | process.env.NODE_ENV = 'development'; 71 | return testBuild({}, 'build-mergeCustomConfig-environment-development'); 72 | }); 73 | it('should support config', () => { 74 | return testBuild({config:'webpack.config.path.js'}, 'build-mergeCustomConfig-path'); 75 | }); 76 | it('should support dedupe', () => { 77 | return testBuild({}, 'build-dedupePlugin-enabled'); 78 | }); 79 | it('should support hash map', () => { 80 | return testBuild({hash:true}, 'build-hash-map'); 81 | }); 82 | it('should support i18n', () => { 83 | return testBuild({}, 'build-i18n'); 84 | }); 85 | it('should support decorator', () => { 86 | return testBuild({}, 'build-decorator'); 87 | }); 88 | it('should support es3', () => { 89 | return testBuild({}, 'build-es3'); 90 | }); 91 | it('should support typescript', () => { 92 | return testBuild({}, 'build-typescript'); 93 | }); 94 | it('should support theme', () => { 95 | return testBuild({}, 'build-theme'); 96 | }); 97 | it('should support font', () => { 98 | return testBuild({}, 'build-font'); 99 | }); 100 | it('should support autoprefix', () => { 101 | return testBuild({}, 'build-autoprefix'); 102 | }); 103 | it('should support common', () => { 104 | return testBuild({}, 'build-common'); 105 | }); 106 | it('should support svg', () => { 107 | return testBuild({}, 'build-svg'); 108 | }); 109 | it('should throw error', () => { 110 | return testBuild({}, 'build-no-entry') 111 | .catch((err) => { 112 | expect(err.name).toEqual('NoEntry'); 113 | expect(err.message).toEqual('no webpack entry found'); 114 | }); 115 | }); 116 | it('should support notify', () => { 117 | return testBuild({ hash: true, notify: true }, 'build-normal'); 118 | }); 119 | it('should custom babel', () => { 120 | return testBuild({}, 'build-mergeCustomConfig-babel'); 121 | }); 122 | }); 123 | -------------------------------------------------------------------------------- /src/injectLoaderOptions.js: -------------------------------------------------------------------------------- 1 | import { existsSync } from 'fs'; 2 | import { join, resolve } from 'path'; 3 | import ExtractTextPlugin from 'extract-text-webpack-plugin'; 4 | import getTSCommonConfig from './getTSCommonConfig'; 5 | 6 | const tsQuery = getTSCommonConfig(); 7 | 8 | function injectPostcssOptions(webpackConfig, args) { 9 | const postcssOptions = webpackConfig.postcss; 10 | delete webpackConfig.postcss; // eslint-disable-line 11 | 12 | const pkgPath = join(args.cwd, 'package.json'); 13 | const pkg = existsSync(pkgPath) ? require(pkgPath) : {}; 14 | 15 | let theme = {}; 16 | if (pkg.theme && typeof pkg.theme === 'string') { 17 | let cfgPath = pkg.theme; 18 | // relative path 19 | if (cfgPath.charAt(0) === '.') { 20 | cfgPath = resolve(args.cwd, cfgPath); 21 | } 22 | const getThemeConfig = require(cfgPath); 23 | theme = getThemeConfig(); 24 | } else if (pkg.theme && typeof pkg.theme === 'object') { 25 | theme = pkg.theme; 26 | } 27 | 28 | webpackConfig.module.rules.push( 29 | { 30 | test(filePath) { 31 | return /\.css$/.test(filePath) && !/\.module\.css$/.test(filePath); 32 | }, 33 | use: ExtractTextPlugin.extract({ 34 | use: [ 35 | { 36 | loader: 'css-loader', 37 | options: { 38 | sourceMap: true, 39 | }, 40 | }, 41 | { 42 | loader: 'postcss-loader', 43 | options: postcssOptions, 44 | }, 45 | ], 46 | }), 47 | }, 48 | { 49 | test: /\.module\.css$/, 50 | use: ExtractTextPlugin.extract({ 51 | use: [ 52 | { 53 | loader: 'css-loader', 54 | options: { 55 | sourceMap: true, 56 | modules: true, 57 | localIdentName: '[local]___[hash:base64:5]', 58 | }, 59 | }, 60 | { 61 | loader: 'postcss-loader', 62 | options: postcssOptions, 63 | }, 64 | ], 65 | }), 66 | }, 67 | { 68 | test(filePath) { 69 | return /\.less$/.test(filePath) && !/\.module\.less$/.test(filePath); 70 | }, 71 | use: ExtractTextPlugin.extract({ 72 | use: [ 73 | { 74 | loader: 'css-loader', 75 | options: { 76 | sourceMap: true, 77 | }, 78 | }, 79 | { 80 | loader: 'postcss-loader', 81 | options: postcssOptions, 82 | }, 83 | { 84 | loader: 'less-loader', 85 | options: { 86 | sourceMap: true, 87 | modifyVars: theme, 88 | }, 89 | }, 90 | ], 91 | }), 92 | }, 93 | { 94 | test: /\.module\.less$/, 95 | use: ExtractTextPlugin.extract({ 96 | use: [ 97 | { 98 | loader: 'css-loader', 99 | options: { 100 | sourceMap: true, 101 | modules: true, 102 | localIdentName: '[local]___[hash:base64:5]', 103 | }, 104 | }, 105 | { 106 | loader: 'postcss-loader', 107 | options: postcssOptions, 108 | }, 109 | { 110 | loader: 'less-loader', 111 | options: { 112 | sourceMap: true, 113 | modifyVars: theme, 114 | }, 115 | }, 116 | ], 117 | }), 118 | }, 119 | ); 120 | } 121 | 122 | function injectBabelOptions(webpackConfig) { 123 | const babelOptions = webpackConfig.babel; 124 | delete webpackConfig.babel; // eslint-disable-line 125 | 126 | webpackConfig.module.rules.push( 127 | { 128 | test: /\.jsx?$/, 129 | exclude: /node_modules/, 130 | loader: 'babel-loader', 131 | options: babelOptions, 132 | }, 133 | { 134 | test: /\.tsx?$/, 135 | use: [ 136 | { 137 | loader: 'babel-loader', 138 | options: babelOptions, 139 | }, 140 | { 141 | loader: 'ts-loader', 142 | options: { 143 | transpileOnly: true, 144 | compilerOptions: tsQuery, 145 | }, 146 | }, 147 | ], 148 | }, 149 | ); 150 | } 151 | 152 | export default function injectLoaderOptions(webpackConfig, args) { 153 | injectPostcssOptions(webpackConfig, args); 154 | injectBabelOptions(webpackConfig); 155 | } 156 | -------------------------------------------------------------------------------- /src/getWebpackCommonConfig.js: -------------------------------------------------------------------------------- 1 | import webpack from 'webpack'; 2 | import ExtractTextPlugin from 'extract-text-webpack-plugin'; 3 | import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin'; 4 | import { existsSync } from 'fs'; 5 | import { join } from 'path'; 6 | import rucksack from 'rucksack-css'; 7 | import autoprefixer from 'autoprefixer'; 8 | import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin'; 9 | import notifier from 'node-notifier'; 10 | 11 | import getBabelCommonConfig from './getBabelCommonConfig'; 12 | /* eslint quotes:0 */ 13 | 14 | export default function getWebpackCommonConfig(args) { 15 | const pkgPath = join(args.cwd, 'package.json'); 16 | const pkg = existsSync(pkgPath) ? require(pkgPath) : {}; 17 | 18 | const jsFileName = args.hash ? '[name]-[chunkhash].js' : '[name].js'; 19 | const cssFileName = args.hash ? '[name]-[chunkhash].css' : '[name].css'; 20 | const commonName = args.hash ? 'common-[chunkhash].js' : 'common.js'; 21 | 22 | const silent = args.silent === true; 23 | const babelOptions = getBabelCommonConfig(); 24 | 25 | const postcssOptions = { 26 | sourceMap: true, 27 | plugins: [ 28 | rucksack(), 29 | autoprefixer({ 30 | browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 8', 'iOS >= 8', 'Android >= 4'], 31 | }), 32 | ], 33 | }; 34 | 35 | const emptyBuildins = [ 36 | 'child_process', 37 | 'cluster', 38 | 'dgram', 39 | 'dns', 40 | 'fs', 41 | 'module', 42 | 'net', 43 | 'readline', 44 | 'repl', 45 | 'tls', 46 | ]; 47 | 48 | const browser = pkg.browser || {}; 49 | 50 | const node = emptyBuildins.reduce((obj, name) => { 51 | if (!(name in browser)) { 52 | return { ...obj, ...{ [name]: 'empty' } }; 53 | } 54 | return obj; 55 | }, {}); 56 | 57 | const config = { 58 | babel: babelOptions, 59 | postcss: postcssOptions, 60 | 61 | output: { 62 | path: join(process.cwd(), './dist/'), 63 | filename: jsFileName, 64 | chunkFilename: jsFileName, 65 | }, 66 | 67 | devtool: args.devtool, 68 | 69 | resolve: { 70 | modules: ['node_modules', join(__dirname, '../node_modules')], 71 | extensions: ['.web.tsx', '.web.ts', '.web.jsx', '.web.js', '.ts', '.tsx', '.js', '.jsx', '.json'], 72 | }, 73 | 74 | entry: pkg.entry, 75 | 76 | node, 77 | 78 | module: { 79 | noParse: [/moment.js/], 80 | rules: [ 81 | 82 | { 83 | test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, 84 | loader: 'url-loader', 85 | options: { 86 | limit: 10000, 87 | minetype: 'application/font-woff', 88 | }, 89 | }, 90 | { 91 | test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, 92 | loader: 'url-loader', 93 | options: { 94 | limit: 10000, 95 | minetype: 'application/font-woff', 96 | }, 97 | }, 98 | { 99 | test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, 100 | loader: 'url-loader', 101 | options: { 102 | limit: 10000, 103 | minetype: 'application/octet-stream', 104 | }, 105 | }, 106 | { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, 107 | loader: 'url-loader', 108 | options: { 109 | limit: 10000, 110 | minetype: 'application/vnd.ms-fontobject', 111 | }, 112 | }, 113 | { 114 | test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, 115 | loader: 'url-loader', 116 | options: { 117 | limit: 10000, 118 | minetype: 'image/svg+xml', 119 | }, 120 | }, 121 | { 122 | test: /\.(png|jpg|jpeg|gif)(\?v=\d+\.\d+\.\d+)?$/i, 123 | loader: 'url-loader', 124 | options: { 125 | limit: 10000, 126 | }, 127 | }, 128 | { 129 | test: /\.html?$/, 130 | loader: 'file-loader', 131 | options: { 132 | name: '[name].[ext]', 133 | }, 134 | }, 135 | ], 136 | }, 137 | 138 | plugins: [ 139 | new webpack.optimize.CommonsChunkPlugin({ 140 | name: 'common', 141 | filename: commonName, 142 | }), 143 | new ExtractTextPlugin({ 144 | filename: cssFileName, 145 | disable: false, 146 | allChunks: true, 147 | }), 148 | new CaseSensitivePathsPlugin(), 149 | new FriendlyErrorsWebpackPlugin({ 150 | onErrors: (severity, errors) => { 151 | if (silent) return; 152 | if (severity !== 'error') { 153 | notifier.notify({ 154 | title: 'ant tool', 155 | message: 'warn', 156 | contentImage: join(__dirname, '../assets/warn.png'), 157 | sound: 'Glass', 158 | }); 159 | return; 160 | } 161 | const error = errors[0]; 162 | notifier.notify({ 163 | title: 'ant tool', 164 | message: `${severity} : ${error.name}`, 165 | subtitle: error.file || '', 166 | contentImage: join(__dirname, '../assets/fail.png'), 167 | sound: 'Glass', 168 | }); 169 | }, 170 | }), 171 | ], 172 | }; 173 | 174 | return config; 175 | } 176 | -------------------------------------------------------------------------------- /src/build.js: -------------------------------------------------------------------------------- 1 | import { join, resolve } from 'path'; 2 | import { writeFileSync } from 'fs'; 3 | import webpack, { ProgressPlugin } from 'webpack'; 4 | import chalk from 'chalk'; 5 | import notifier from 'node-notifier'; 6 | import mergeCustomConfig from './mergeCustomConfig'; 7 | import getWebpackCommonConfig from './getWebpackCommonConfig'; 8 | import injectLoaderOptions from './injectLoaderOptions'; 9 | 10 | function checkConfig(webpackConfig) { 11 | const config = Array.isArray(webpackConfig) ? webpackConfig : [webpackConfig]; 12 | const hasEmptyEntry = config.some(c => Object.keys(c.entry || {}).length === 0); 13 | if (hasEmptyEntry) { 14 | const err = new Error('no webpack entry found'); 15 | err.name = 'NoEntry'; 16 | throw err; 17 | } 18 | } 19 | 20 | function getWebpackConfig(args, cache) { 21 | let webpackConfig = getWebpackCommonConfig(args); 22 | 23 | webpackConfig.plugins = webpackConfig.plugins || []; 24 | 25 | // Config outputPath. 26 | if (args.outputPath) { 27 | webpackConfig.output.path = args.outputPath; 28 | } 29 | 30 | if (args.publicPath) { 31 | webpackConfig.output.publicPath = args.publicPath; 32 | } 33 | 34 | // Config if no --no-compress. 35 | // Watch mode should not use UglifyJsPlugin 36 | if (args.compress && !args.watch) { 37 | webpackConfig.plugins = [...webpackConfig.plugins, 38 | new webpack.optimize.UglifyJsPlugin({ 39 | parallel: true, 40 | output: { 41 | ascii_only: true, 42 | }, 43 | compress: { 44 | warnings: false, 45 | }, 46 | }), 47 | new webpack.DefinePlugin({ 48 | 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'), 49 | }), 50 | ]; 51 | } else { 52 | webpackConfig.plugins = [...webpackConfig.plugins, 53 | new webpack.DefinePlugin({ 54 | 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), 55 | }), 56 | ]; 57 | } 58 | 59 | webpackConfig.plugins = [...webpackConfig.plugins, 60 | new webpack.NoEmitOnErrorsPlugin(), 61 | ]; 62 | 63 | // Output map.json if hash. 64 | if (args.hash) { 65 | const pkg = require(join(args.cwd, 'package.json')); 66 | webpackConfig.output.filename = '[name]-[chunkhash].js'; 67 | webpackConfig.output.chunkFilename = '[name]-[chunkhash].js'; 68 | webpackConfig.plugins = [...webpackConfig.plugins, 69 | require('map-json-webpack-plugin')({ 70 | assetsPath: pkg.name, 71 | cache, 72 | }), 73 | ]; 74 | } 75 | 76 | if (typeof args.config === 'function') { 77 | webpackConfig = args.config(webpackConfig) || webpackConfig; 78 | } else { 79 | webpackConfig = mergeCustomConfig(webpackConfig, resolve(args.cwd, args.config || 'webpack.config.js')); 80 | } 81 | checkConfig(webpackConfig); 82 | return webpackConfig; 83 | } 84 | 85 | export default function build(args, callback) { 86 | // Get config. 87 | let webpackConfig = getWebpackConfig(args, {}); 88 | webpackConfig = Array.isArray(webpackConfig) ? webpackConfig : [webpackConfig]; 89 | 90 | let fileOutputPath; 91 | webpackConfig.forEach((config) => { 92 | injectLoaderOptions(config, args); 93 | fileOutputPath = config.output.path; 94 | }); 95 | 96 | 97 | webpackConfig.forEach((config) => { 98 | config.plugins.push( 99 | new ProgressPlugin((percentage, msg, addInfo) => { 100 | const stream = process.stderr; 101 | if (stream.isTTY && percentage < 0.71) { 102 | stream.cursorTo(0); 103 | stream.write(`📦 ${chalk.magenta(msg)} (${chalk.magenta(addInfo)})`); 104 | stream.clearLine(1); 105 | } else if (percentage === 1) { 106 | console.log(chalk.green('\nwebpack: bundle build is now finished.')); 107 | } 108 | }), 109 | ); 110 | }); 111 | 112 | 113 | function doneHandler(err, stats) { 114 | if (args.json) { 115 | const filename = typeof args.json === 'boolean' ? 'build-bundle.json' : args.json; 116 | const jsonPath = join(fileOutputPath, filename); 117 | writeFileSync(jsonPath, JSON.stringify(stats.toJson()), 'utf-8'); 118 | console.log(`Generate Json File: ${jsonPath}`); 119 | } 120 | 121 | const { errors } = stats.toJson(); 122 | if (errors && errors.length) { 123 | callback(errors); 124 | } 125 | // if watch enabled only stats.hasErrors would log info 126 | // otherwise would always log info 127 | if (!args.watch || stats.hasErrors()) { 128 | const buildInfo = stats.toString({ 129 | colors: true, 130 | children: true, 131 | chunks: !!args.verbose, 132 | modules: !!args.verbose, 133 | chunkModules: !!args.verbose, 134 | hash: !!args.verbose, 135 | version: !!args.verbose, 136 | }); 137 | if (stats.hasErrors()) { 138 | console.error(buildInfo); 139 | } else { 140 | console.log(buildInfo); 141 | if (args.notify === true) { 142 | notifier.notify({ 143 | title: 'ant tool', 144 | message: 'done', 145 | subtitle: 'build successfully', 146 | contentImage: join(__dirname, '../assets/success.png'), 147 | sound: 'Glass', 148 | }); 149 | } 150 | } 151 | } 152 | 153 | if (callback) { 154 | callback(err); 155 | } 156 | } 157 | 158 | // Run compiler. 159 | const compiler = webpack(webpackConfig); 160 | 161 | // Hack: remove extract-text-webpack-plugin log 162 | if (!args.verbose) { 163 | compiler.plugin('done', (stats) => { 164 | stats.stats.forEach((stat) => { 165 | stat.compilation.children = stat.compilation.children.filter((child) => {// eslint-disable-line 166 | return child.name !== 'extract-text-webpack-plugin'; 167 | }); 168 | }); 169 | }); 170 | } 171 | 172 | if (args.watch) { 173 | compiler.watch(args.watch || 200, doneHandler); 174 | } else { 175 | compiler.run(doneHandler); 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /test/expect/build-es3/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-jsx/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-svg/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-font/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-i18n/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-json/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-less/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-theme/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-autoprefix/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-css-modules/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-decorator/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-node-builtins/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-typescript/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-add-module-exports/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-class-property/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-dedupePlugin-enabled/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-mergeCustomConfig-babel/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-mergeCustomConfig-environment-development/common.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-normal/common-8d2b1e3a44d8c25d78f8.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + "-" + {"0":"9ef985f8fe74a50efc00"}[chunkId] + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); -------------------------------------------------------------------------------- /test/expect/build-hash-map/build-hash-map/0.0.1/common-8d2b1e3a44d8c25d78f8.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // install a JSONP callback for chunk loading 3 | /******/ var parentJsonpFunction = window["webpackJsonp"]; 4 | /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { 5 | /******/ // add "moreModules" to the modules object, 6 | /******/ // then flag all "chunkIds" as loaded and fire callback 7 | /******/ var moduleId, chunkId, i = 0, resolves = [], result; 8 | /******/ for(;i < chunkIds.length; i++) { 9 | /******/ chunkId = chunkIds[i]; 10 | /******/ if(installedChunks[chunkId]) { 11 | /******/ resolves.push(installedChunks[chunkId][0]); 12 | /******/ } 13 | /******/ installedChunks[chunkId] = 0; 14 | /******/ } 15 | /******/ for(moduleId in moreModules) { 16 | /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { 17 | /******/ modules[moduleId] = moreModules[moduleId]; 18 | /******/ } 19 | /******/ } 20 | /******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules); 21 | /******/ while(resolves.length) { 22 | /******/ resolves.shift()(); 23 | /******/ } 24 | /******/ if(executeModules) { 25 | /******/ for(i=0; i < executeModules.length; i++) { 26 | /******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]); 27 | /******/ } 28 | /******/ } 29 | /******/ return result; 30 | /******/ }; 31 | /******/ 32 | /******/ // The module cache 33 | /******/ var installedModules = {}; 34 | /******/ 35 | /******/ // objects to store loaded and loading chunks 36 | /******/ var installedChunks = { 37 | /******/ 1: 0 38 | /******/ }; 39 | /******/ 40 | /******/ // The require function 41 | /******/ function __webpack_require__(moduleId) { 42 | /******/ 43 | /******/ // Check if module is in cache 44 | /******/ if(installedModules[moduleId]) { 45 | /******/ return installedModules[moduleId].exports; 46 | /******/ } 47 | /******/ // Create a new module (and put it into the cache) 48 | /******/ var module = installedModules[moduleId] = { 49 | /******/ i: moduleId, 50 | /******/ l: false, 51 | /******/ exports: {} 52 | /******/ }; 53 | /******/ 54 | /******/ // Execute the module function 55 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 56 | /******/ 57 | /******/ // Flag the module as loaded 58 | /******/ module.l = true; 59 | /******/ 60 | /******/ // Return the exports of the module 61 | /******/ return module.exports; 62 | /******/ } 63 | /******/ 64 | /******/ // This file contains only the entry chunk. 65 | /******/ // The chunk loading function for additional chunks 66 | /******/ __webpack_require__.e = function requireEnsure(chunkId) { 67 | /******/ var installedChunkData = installedChunks[chunkId]; 68 | /******/ if(installedChunkData === 0) { 69 | /******/ return new Promise(function(resolve) { resolve(); }); 70 | /******/ } 71 | /******/ 72 | /******/ // a Promise means "currently loading". 73 | /******/ if(installedChunkData) { 74 | /******/ return installedChunkData[2]; 75 | /******/ } 76 | /******/ 77 | /******/ // setup Promise in chunk cache 78 | /******/ var promise = new Promise(function(resolve, reject) { 79 | /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; 80 | /******/ }); 81 | /******/ installedChunkData[2] = promise; 82 | /******/ 83 | /******/ // start chunk loading 84 | /******/ var head = document.getElementsByTagName('head')[0]; 85 | /******/ var script = document.createElement('script'); 86 | /******/ script.type = 'text/javascript'; 87 | /******/ script.charset = 'utf-8'; 88 | /******/ script.async = true; 89 | /******/ script.timeout = 120000; 90 | /******/ 91 | /******/ if (__webpack_require__.nc) { 92 | /******/ script.setAttribute("nonce", __webpack_require__.nc); 93 | /******/ } 94 | /******/ script.src = __webpack_require__.p + "" + ({"0":"index"}[chunkId]||chunkId) + "-" + {"0":"9ef985f8fe74a50efc00"}[chunkId] + ".js"; 95 | /******/ var timeout = setTimeout(onScriptComplete, 120000); 96 | /******/ script.onerror = script.onload = onScriptComplete; 97 | /******/ function onScriptComplete() { 98 | /******/ // avoid mem leaks in IE. 99 | /******/ script.onerror = script.onload = null; 100 | /******/ clearTimeout(timeout); 101 | /******/ var chunk = installedChunks[chunkId]; 102 | /******/ if(chunk !== 0) { 103 | /******/ if(chunk) { 104 | /******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.')); 105 | /******/ } 106 | /******/ installedChunks[chunkId] = undefined; 107 | /******/ } 108 | /******/ }; 109 | /******/ head.appendChild(script); 110 | /******/ 111 | /******/ return promise; 112 | /******/ }; 113 | /******/ 114 | /******/ // expose the modules object (__webpack_modules__) 115 | /******/ __webpack_require__.m = modules; 116 | /******/ 117 | /******/ // expose the module cache 118 | /******/ __webpack_require__.c = installedModules; 119 | /******/ 120 | /******/ // define getter function for harmony exports 121 | /******/ __webpack_require__.d = function(exports, name, getter) { 122 | /******/ if(!__webpack_require__.o(exports, name)) { 123 | /******/ Object.defineProperty(exports, name, { 124 | /******/ configurable: false, 125 | /******/ enumerable: true, 126 | /******/ get: getter 127 | /******/ }); 128 | /******/ } 129 | /******/ }; 130 | /******/ 131 | /******/ // getDefaultExport function for compatibility with non-harmony modules 132 | /******/ __webpack_require__.n = function(module) { 133 | /******/ var getter = module && module.__esModule ? 134 | /******/ function getDefault() { return module['default']; } : 135 | /******/ function getModuleExports() { return module; }; 136 | /******/ __webpack_require__.d(getter, 'a', getter); 137 | /******/ return getter; 138 | /******/ }; 139 | /******/ 140 | /******/ // Object.prototype.hasOwnProperty.call 141 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 142 | /******/ 143 | /******/ // __webpack_public_path__ 144 | /******/ __webpack_require__.p = ""; 145 | /******/ 146 | /******/ // on error function for async loading 147 | /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; 148 | /******/ }) 149 | /************************************************************************/ 150 | /******/ ([]); --------------------------------------------------------------------------------