├── .editorconfig ├── .eslintrc ├── .gitattributes ├── .gitignore ├── .jsbeautifyrc ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── appveyor.yml ├── benchmark ├── benchmark.js └── createFixtures.js ├── bin ├── config-optimist.js ├── convert-argv.js └── webpack.js ├── buildin ├── amd-define.js ├── amd-options.js ├── module.js └── return-require.js ├── examples ├── README.md ├── agressive-merging │ ├── README.md │ ├── a.js │ ├── b.js │ ├── build.js │ ├── common.js │ ├── pageA.js │ ├── pageB.js │ ├── pageC.js │ ├── template.md │ └── webpack.config.js ├── build-common.js ├── buildAll.js ├── chunkhash │ ├── README.md │ ├── async1.js │ ├── async2.js │ ├── build.js │ ├── example.js │ ├── template.md │ ├── vendor.js │ └── webpack.config.js ├── code-splitted-css-bundle │ ├── README.md │ ├── build.js │ ├── chunk.js │ ├── example.js │ ├── image.png │ ├── image2.png │ ├── style.css │ ├── style2.css │ ├── template.md │ └── webpack.config.js ├── code-splitted-dedupe │ ├── README.md │ ├── build.js │ ├── example.js │ ├── template.md │ └── webpack.config.js ├── code-splitted-require.context-amd │ ├── README.md │ ├── build.js │ ├── example.js │ └── template.md ├── code-splitted-require.context │ ├── README.md │ ├── build.js │ ├── example.js │ └── template.md ├── code-splitting-bundle-loader │ ├── README.md │ ├── build.js │ ├── example.js │ ├── file.js │ └── template.md ├── code-splitting-harmony │ ├── README.md │ ├── build.js │ ├── example.js │ ├── node_modules │ │ ├── a.js │ │ ├── b.js │ │ └── c │ │ │ ├── 1.js │ │ │ └── 2.js │ └── template.md ├── code-splitting │ ├── README.md │ ├── build.js │ ├── example.js │ ├── node_modules │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ └── d.js │ └── template.md ├── coffee-script │ ├── README.md │ ├── build.js │ ├── cup1.coffee │ ├── cup2.coffee │ ├── example.js │ ├── template.md │ └── webpack.config.js ├── commonjs │ ├── README.md │ ├── build.js │ ├── example.js │ ├── increment.js │ ├── math.js │ └── template.md ├── css-bundle │ ├── README.md │ ├── build.js │ ├── example.js │ ├── image.png │ ├── style.css │ ├── template.md │ └── webpack.config.js ├── dedupe │ ├── README.md │ ├── a │ │ ├── index.js │ │ ├── x.js │ │ └── y.js │ ├── b │ │ ├── index.js │ │ ├── x.js │ │ └── y.js │ ├── build.js │ ├── example.js │ ├── template.md │ ├── webpack.config.js │ └── z.js ├── dll-user │ ├── README.md │ ├── build.js │ ├── example.html │ ├── example.js │ ├── template.md │ └── webpack.config.js ├── dll │ ├── README.md │ ├── a.js │ ├── alpha.js │ ├── b.js │ ├── beta.js │ ├── build.js │ ├── template.md │ └── webpack.config.js ├── explicit-vendor-chunk │ ├── README.md │ ├── build.js │ ├── pageA.html │ ├── pageA.js │ ├── pageB.js │ ├── pageC.js │ ├── template.md │ ├── vendor.js │ └── webpack.config.js ├── externals │ ├── README.md │ ├── build.js │ ├── example.js │ ├── template.md │ └── webpack.config.js ├── extra-async-chunk-advanced │ ├── README.md │ ├── a.js │ ├── b.js │ ├── build.js │ ├── c.js │ ├── d.js │ ├── e.js │ ├── example.js │ ├── f.js │ ├── g.js │ ├── template.md │ └── webpack.config.js ├── extra-async-chunk │ ├── README.md │ ├── a.js │ ├── b.js │ ├── build.js │ ├── c.js │ ├── d.js │ ├── example.js │ ├── template.md │ └── webpack.config.js ├── harmony-unused │ ├── README.md │ ├── abc.js │ ├── build.js │ ├── example.js │ ├── library.js │ ├── math.js │ └── template.md ├── harmony │ ├── README.md │ ├── async-loaded.js │ ├── build.js │ ├── example.js │ ├── increment.js │ ├── math.js │ └── template.md ├── hybrid-routing │ ├── README.md │ ├── aEntry.js │ ├── aPage.js │ ├── bEntry.js │ ├── bPage.js │ ├── build.js │ ├── pageA.html │ ├── pageB.html │ ├── render.js │ ├── router.js │ ├── template.md │ └── webpack.config.js ├── i18n │ ├── README.md │ ├── build.js │ ├── de.json │ ├── example.js │ ├── template.md │ └── webpack.config.js ├── labeled-modules │ ├── README.md │ ├── build.js │ ├── example.js │ ├── increment.js │ ├── math.js │ ├── template.md │ └── webpack.config.js ├── loader │ ├── README.md │ ├── build.js │ ├── enhanced-require.config.js │ ├── example.js │ ├── file.js │ ├── loader.js │ ├── template.md │ ├── test.json │ └── webpack.config.js ├── mixed │ ├── README.md │ ├── amd.js │ ├── build.js │ ├── commonjs.js │ ├── example.js │ ├── labeled.js │ ├── template.md │ └── webpack.config.js ├── move-to-parent │ ├── README.md │ ├── a.js │ ├── b.js │ ├── build.js │ ├── c.js │ ├── d.js │ ├── page.js │ ├── template.md │ └── webpack.config.js ├── multi-compiler │ ├── README.md │ ├── build.js │ ├── example.js │ ├── mobile-stuff.js │ ├── template.md │ └── webpack.config.js ├── multi-part-library │ ├── README.md │ ├── alpha.js │ ├── beta.js │ ├── build.js │ ├── template.md │ └── webpack.config.js ├── multiple-commons-chunks │ ├── README.md │ ├── adminPageA.html │ ├── adminPageA.js │ ├── adminPageB.js │ ├── adminPageC.js │ ├── build.js │ ├── common.js │ ├── modules │ │ ├── a-b-c.js │ │ ├── a-b.js │ │ ├── a-c.js │ │ ├── admin.js │ │ └── b-c.js │ ├── pageA.html │ ├── pageA.js │ ├── pageB.js │ ├── pageC.js │ ├── template.md │ └── webpack.config.js ├── multiple-entry-points-commons-chunk-css-bundle │ ├── README.md │ ├── a.js │ ├── b.js │ ├── build.js │ ├── c.js │ ├── image.png │ ├── imageA.png │ ├── imageB.png │ ├── imageC.png │ ├── style.css │ ├── styleA.css │ ├── styleB.css │ ├── styleC.css │ ├── template.md │ └── webpack.config.js ├── multiple-entry-points │ ├── README.md │ ├── build.js │ ├── common.js │ ├── pageA.html │ ├── pageA.js │ ├── pageAB.html │ ├── pageB.js │ ├── shared.js │ ├── template.md │ └── webpack.config.js ├── named-chunks │ ├── README.md │ ├── build.js │ ├── example.js │ ├── node_modules │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ └── d.js │ └── template.md ├── node_modules │ └── module.js ├── require.context │ ├── README.md │ ├── build.js │ ├── example.js │ ├── template.md │ └── templates │ │ ├── a.js │ │ ├── b.js │ │ └── c.js ├── require.resolve │ ├── README.md │ ├── a.js │ ├── build.js │ ├── example.js │ └── template.md ├── template-common.js ├── two-explicit-vendor-chunks │ ├── README.md │ ├── build.js │ ├── pageA.html │ ├── pageA.js │ ├── pageB.js │ ├── pageC.js │ ├── template.md │ ├── vendor1.js │ ├── vendor2.js │ └── webpack.config.js └── web-worker │ ├── README.md │ ├── build.js │ ├── example.js │ ├── template.md │ ├── webpack.config.js │ └── worker.js ├── hot ├── dev-server.js ├── emitter.js ├── log-apply-result.js ├── only-dev-server.js ├── poll.js └── signal.js ├── lib ├── APIPlugin.js ├── AbstractPlugin.js ├── AmdMainTemplatePlugin.js ├── ArrayMap.js ├── AsyncDependenciesBlock.js ├── AutomaticPrefetchPlugin.js ├── BannerPlugin.js ├── BasicEvaluatedExpression.js ├── CachePlugin.js ├── CaseSensitiveModulesWarning.js ├── Chunk.js ├── ChunkRenderError.js ├── ChunkTemplate.js ├── CompatibilityPlugin.js ├── Compilation.js ├── Compiler.js ├── ConstPlugin.js ├── ContextModule.js ├── ContextModuleFactory.js ├── ContextReplacementPlugin.js ├── CriticalDependenciesWarning.js ├── DefinePlugin.js ├── DelegatedModule.js ├── DelegatedModuleFactoryPlugin.js ├── DelegatedPlugin.js ├── DependenciesBlock.js ├── DependenciesBlockVariable.js ├── Dependency.js ├── DllEntryPlugin.js ├── DllModule.js ├── DllModuleFactory.js ├── DllPlugin.js ├── DllReferencePlugin.js ├── EntryModuleNotFoundError.js ├── EntryOptionPlugin.js ├── EnvironmentPlugin.js ├── EvalDevToolModulePlugin.js ├── EvalDevToolModuleTemplatePlugin.js ├── EvalSourceMapDevToolModuleTemplatePlugin.js ├── EvalSourceMapDevToolPlugin.js ├── ExtendedAPIPlugin.js ├── ExternalModule.js ├── ExternalModuleFactoryPlugin.js ├── ExternalsPlugin.js ├── FlagDependencyUsagePlugin.js ├── FunctionModulePlugin.js ├── FunctionModuleTemplatePlugin.js ├── HashedModuleIdsPlugin.js ├── HotModuleReplacement.runtime.js ├── HotModuleReplacementPlugin.js ├── HotUpdateChunkTemplate.js ├── IgnorePlugin.js ├── JsonpChunkTemplatePlugin.js ├── JsonpExportMainTemplatePlugin.js ├── JsonpHotUpdateChunkTemplatePlugin.js ├── JsonpMainTemplate.runtime.js ├── JsonpMainTemplatePlugin.js ├── JsonpTemplatePlugin.js ├── LibManifestPlugin.js ├── LibraryTemplatePlugin.js ├── LoaderOptionsPlugin.js ├── LoaderTargetPlugin.js ├── LoadersList.js ├── MainTemplate.js ├── MemoryOutputFileSystem.js ├── Module.js ├── ModuleBuildError.js ├── ModuleError.js ├── ModuleFilenameHelpers.js ├── ModuleNotFoundError.js ├── ModuleParseError.js ├── ModuleParserHelpers.js ├── ModuleReason.js ├── ModuleTemplate.js ├── ModuleWarning.js ├── MovedToPluginWarningPlugin.js ├── MultiCompiler.js ├── MultiEntryPlugin.js ├── MultiModule.js ├── MultiModuleFactory.js ├── NamedModulesPlugin.js ├── NewWatchingPlugin.js ├── NoErrorsPlugin.js ├── NodeStuffPlugin.js ├── NormalModule.js ├── NormalModuleFactory.js ├── NormalModuleReplacementPlugin.js ├── NullFactory.js ├── OldWatchingPlugin.js ├── OptionsApply.js ├── OptionsDefaulter.js ├── Parser.js ├── PrefetchPlugin.js ├── ProgressPlugin.js ├── ProvidePlugin.js ├── RawModule.js ├── RecordIdsPlugin.js ├── RequestShortener.js ├── RequireJsStuffPlugin.js ├── SetVarMainTemplatePlugin.js ├── SingleEntryPlugin.js ├── SourceMapDevToolModuleOptionsPlugin.js ├── SourceMapDevToolPlugin.js ├── Stats.js ├── Template.js ├── TemplatedPathPlugin.js ├── UmdMainTemplatePlugin.js ├── UnsupportedFeatureWarning.js ├── WarnCaseSensitiveModulesPlugin.js ├── WatchIgnorePlugin.js ├── WebpackOptionsApply.js ├── WebpackOptionsDefaulter.js ├── dependencies │ ├── AMDDefineDependency.js │ ├── AMDDefineDependencyParserPlugin.js │ ├── AMDPlugin.js │ ├── AMDRequireArrayDependency.js │ ├── AMDRequireContextDependency.js │ ├── AMDRequireDependenciesBlock.js │ ├── AMDRequireDependenciesBlockParserPlugin.js │ ├── AMDRequireDependency.js │ ├── AMDRequireItemDependency.js │ ├── CommonJsPlugin.js │ ├── CommonJsRequireContextDependency.js │ ├── CommonJsRequireDependency.js │ ├── CommonJsRequireDependencyParserPlugin.js │ ├── ConstDependency.js │ ├── ContextDependency.js │ ├── ContextDependencyHelpers.js │ ├── ContextDependencyTemplateAsId.js │ ├── ContextDependencyTemplateAsRequireCall.js │ ├── ContextElementDependency.js │ ├── DelegatedSourceDependency.js │ ├── DepBlockHelpers.js │ ├── DllEntryDependency.js │ ├── HarmonyAcceptDependency.js │ ├── HarmonyAcceptImportDependency.js │ ├── HarmonyExportDependencyParserPlugin.js │ ├── HarmonyExportExpressionDependency.js │ ├── HarmonyExportHeaderDependency.js │ ├── HarmonyExportImportedSpecifierDependency.js │ ├── HarmonyExportSpecifierDependency.js │ ├── HarmonyImportDependency.js │ ├── HarmonyImportDependencyParserPlugin.js │ ├── HarmonyImportSpecifierDependency.js │ ├── HarmonyModulesHelpers.js │ ├── HarmonyModulesPlugin.js │ ├── LabeledExportsDependency.js │ ├── LabeledModuleDependency.js │ ├── LabeledModuleDependencyParserPlugin.js │ ├── LabeledModulesPlugin.js │ ├── LoaderDependency.js │ ├── LoaderPlugin.js │ ├── LocalModule.js │ ├── LocalModuleDependency.js │ ├── LocalModulesHelpers.js │ ├── ModuleDependency.js │ ├── ModuleDependencyTemplateAsId.js │ ├── ModuleDependencyTemplateAsRequireId.js │ ├── ModuleHotAcceptDependency.js │ ├── ModuleHotDeclineDependency.js │ ├── MultiEntryDependency.js │ ├── NullDependency.js │ ├── NullDependencyTemplate.js │ ├── PrefetchDependency.js │ ├── RequireContextDependency.js │ ├── RequireContextDependencyParserPlugin.js │ ├── RequireContextPlugin.js │ ├── RequireEnsureDependenciesBlock.js │ ├── RequireEnsureDependenciesBlockParserPlugin.js │ ├── RequireEnsureDependency.js │ ├── RequireEnsureItemDependency.js │ ├── RequireEnsurePlugin.js │ ├── RequireHeaderDependency.js │ ├── RequireIncludeDependency.js │ ├── RequireIncludeDependencyParserPlugin.js │ ├── RequireIncludePlugin.js │ ├── RequireResolveContextDependency.js │ ├── RequireResolveDependency.js │ ├── RequireResolveDependencyParserPlugin.js │ ├── RequireResolveHeaderDependency.js │ ├── SingleEntryDependency.js │ ├── SystemImportContextDependency.js │ ├── SystemImportDependenciesBlock.js │ ├── SystemImportDependency.js │ ├── SystemImportParserPlugin.js │ ├── SystemPlugin.js │ ├── TemplateArgumentDependency.js │ ├── WebpackMissingModule.js │ └── getFunctionExpression.js ├── node │ ├── NodeChunkTemplatePlugin.js │ ├── NodeEnvironmentPlugin.js │ ├── NodeHotUpdateChunkTemplatePlugin.js │ ├── NodeMainTemplate.runtime.js │ ├── NodeMainTemplateAsync.runtime.js │ ├── NodeMainTemplatePlugin.js │ ├── NodeOutputFileSystem.js │ ├── NodeSourcePlugin.js │ ├── NodeTargetPlugin.js │ ├── NodeTemplatePlugin.js │ └── NodeWatchFileSystem.js ├── optimize │ ├── AggressiveMergingPlugin.js │ ├── CommonsChunkPlugin.js │ ├── DedupePlugin.js │ ├── FlagIncludedChunksPlugin.js │ ├── LimitChunkCountPlugin.js │ ├── MergeDuplicateChunksPlugin.js │ ├── MinChunkSizePlugin.js │ ├── OccurrenceOrderPlugin.js │ ├── RemoveEmptyChunksPlugin.js │ ├── RemoveParentModulesPlugin.js │ └── UglifyJsPlugin.js ├── removeAndDo.js ├── web │ └── WebEnvironmentPlugin.js ├── webpack.js ├── webpack.web.js └── webworker │ ├── WebWorkerChunkTemplatePlugin.js │ ├── WebWorkerHotUpdateChunkTemplatePlugin.js │ ├── WebWorkerMainTemplate.runtime.js │ ├── WebWorkerMainTemplatePlugin.js │ └── WebWorkerTemplatePlugin.js ├── package.json ├── test ├── Compiler.test.js ├── ConfigTestCases.test.js ├── Errors.test.js ├── Examples.test.js ├── HotModuleReplacementPlugin.test.js ├── HotTestCases.test.js ├── Integration.test.js ├── NodeTemplatePlugin.test.js ├── NodeWatchFileSystem.test.js ├── Parser.test.js ├── Stats.test.js ├── Template.test.js ├── TestCases.test.js ├── browsertest │ ├── build.js │ ├── img │ │ ├── fail.png │ │ └── image.png │ ├── lib │ │ ├── index.js │ │ ├── index.web.js │ │ ├── stylesheet.css │ │ ├── stylesheet.less │ │ ├── testRequireMain.js │ │ ├── three.js │ │ └── two.js │ ├── library2config.coffee │ ├── middlewareTest.js │ ├── mocha.css │ ├── mocha.js │ ├── node_modules │ │ ├── extra.loader.js │ │ ├── library1 │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── comp.js │ │ │ │ └── component.js │ │ │ └── node_modules │ │ │ │ ├── submodule1 │ │ │ │ └── index.js │ │ │ │ └── submodule2 │ │ │ │ └── index.js │ │ ├── library2 │ │ │ ├── lib │ │ │ │ ├── common.js │ │ │ │ ├── extra.js │ │ │ │ ├── extra2.js │ │ │ │ ├── main.js │ │ │ │ └── test.js │ │ │ ├── node_modules │ │ │ │ ├── submodule1 │ │ │ │ │ └── index.js │ │ │ │ ├── submodule2 │ │ │ │ │ └── index.js │ │ │ │ └── submodule3 │ │ │ │ │ └── index.js │ │ │ └── package.json │ │ ├── library2b.js │ │ ├── subcontent │ │ │ ├── index.js │ │ │ └── test.jade │ │ ├── subcontent2 │ │ │ └── file.js │ │ └── submodule3 │ │ │ └── index.js │ ├── package.json │ ├── tests.html │ └── web_modules │ │ └── subcontent │ │ └── index.js ├── cases │ ├── chunks │ │ ├── context │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── import-context │ │ │ ├── dir │ │ │ │ ├── one.js │ │ │ │ ├── three.js │ │ │ │ └── two.js │ │ │ └── index.js │ │ ├── import │ │ │ ├── index.js │ │ │ └── two.js │ │ ├── named-chunks │ │ │ ├── empty.js │ │ │ └── index.js │ │ ├── parsing │ │ │ ├── empty.js │ │ │ ├── index.js │ │ │ └── require.include.js │ │ ├── runtime │ │ │ ├── a.js │ │ │ ├── acircular.js │ │ │ ├── acircular2.js │ │ │ ├── b.js │ │ │ ├── duplicate.js │ │ │ ├── duplicate2.js │ │ │ ├── empty.js │ │ │ └── index.js │ │ └── weak-dependencies │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── d.js │ │ │ └── index.js │ ├── compile │ │ ├── deduplication-bundle-loader │ │ │ ├── a │ │ │ │ └── file.js │ │ │ ├── b │ │ │ │ └── file.js │ │ │ └── index.js │ │ ├── deduplication │ │ │ ├── d.js │ │ │ ├── dedupe1 │ │ │ │ ├── dupdep.js │ │ │ │ └── index.js │ │ │ ├── dedupe2 │ │ │ │ ├── dupdep.js │ │ │ │ └── index.js │ │ │ └── index.js │ │ └── error-hide-stack │ │ │ ├── errors.js │ │ │ ├── index.js │ │ │ └── loader.js │ ├── context │ │ ├── ignore-hidden-files │ │ │ ├── folder │ │ │ │ └── .file.js │ │ │ └── index.js │ │ ├── issue-1769 │ │ │ ├── folder │ │ │ │ └── 0.js │ │ │ └── index.js │ │ ├── issue-524 │ │ │ └── index.js │ │ └── issue-801 │ │ │ ├── folder │ │ │ └── file.js │ │ │ └── index.js │ ├── loaders │ │ ├── _css │ │ │ ├── folder │ │ │ │ ├── stylesheet-import1.css │ │ │ │ └── stylesheet-import3.css │ │ │ ├── generateCss.js │ │ │ ├── node_modules │ │ │ │ └── resources-module │ │ │ │ │ ├── import2.less │ │ │ │ │ └── stylesheet-import2.css │ │ │ └── stylesheet.css │ │ ├── _resources │ │ │ ├── abc.txt │ │ │ ├── included.jade │ │ │ ├── parent.jade │ │ │ ├── script.coffee │ │ │ └── template.jade │ │ ├── async │ │ │ ├── a.js │ │ │ ├── index.js │ │ │ └── loaders │ │ │ │ ├── asyncloader.js │ │ │ │ └── syncloader.js │ │ ├── coffee-loader │ │ │ ├── index.js │ │ │ ├── module-only.coffee │ │ │ └── script.coffee.md │ │ ├── context │ │ │ └── index.js │ │ ├── css-loader │ │ │ └── index.js │ │ ├── jade-loader │ │ │ └── index.js │ │ ├── json-loader │ │ │ └── index.js │ │ ├── less-loader │ │ │ ├── index.js │ │ │ ├── less │ │ │ │ ├── folder │ │ │ │ │ ├── import1.less │ │ │ │ │ └── url.js │ │ │ │ └── stylesheet.less │ │ │ └── node_modules │ │ │ │ └── resources-module │ │ │ │ ├── import2.less │ │ │ │ └── stylesheet-import2.css │ │ ├── module-description-file │ │ │ ├── index.js │ │ │ ├── node_modules │ │ │ │ └── testloader │ │ │ │ │ ├── lib │ │ │ │ │ ├── loader-indirect.js │ │ │ │ │ ├── loader.js │ │ │ │ │ ├── loader.webpack-loader.js │ │ │ │ │ ├── loader2.web-loader.js │ │ │ │ │ └── loader3.loader.js │ │ │ │ │ └── package.json │ │ │ └── reverseloader.js │ │ ├── query │ │ │ ├── a.js │ │ │ ├── context-query-test │ │ │ │ └── test.js │ │ │ ├── index.js │ │ │ └── loaders │ │ │ │ └── queryloader.js │ │ ├── raw-loader │ │ │ └── index.js │ │ └── val-loader │ │ │ └── index.js │ ├── parsing │ │ ├── bom │ │ │ ├── bomfile.css │ │ │ ├── bomfile.js │ │ │ ├── index.js │ │ │ └── typeof.js │ │ ├── browserify │ │ │ ├── index.js │ │ │ └── warnings.js │ │ ├── chunks │ │ │ ├── file.js │ │ │ └── index.js │ │ ├── context │ │ │ ├── index.js │ │ │ ├── templates │ │ │ │ ├── dump-file.txt │ │ │ │ ├── node_modules │ │ │ │ │ └── xyz.js │ │ │ │ ├── subdir │ │ │ │ │ └── tmpl.js │ │ │ │ ├── templateLoader.js │ │ │ │ ├── templateLoaderIndirect.js │ │ │ │ └── tmpl.js │ │ │ └── warnings.js │ │ ├── es6.nominimize │ │ │ ├── a.js │ │ │ ├── array.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── index.js │ │ │ └── object.js │ │ ├── evaluate │ │ │ ├── a.js │ │ │ ├── index.js │ │ │ └── resourceQuery │ │ │ │ ├── index.js │ │ │ │ └── returnRQ.js │ │ ├── extract-amd │ │ │ ├── a.js │ │ │ ├── c.js │ │ │ ├── circular.js │ │ │ ├── constructor.js │ │ │ ├── d.js │ │ │ ├── index.js │ │ │ ├── optional.js │ │ │ ├── templates │ │ │ │ ├── a.js │ │ │ │ ├── b.js │ │ │ │ └── c.js │ │ │ └── warnings.js │ │ ├── extract-labeled │ │ │ ├── index.js │ │ │ ├── labeledModuleA.js │ │ │ └── labeledModuleB.js │ │ ├── extract-require │ │ │ ├── constructor.js │ │ │ ├── errors.js │ │ │ ├── folder │ │ │ │ ├── file1.js │ │ │ │ ├── file2.js │ │ │ │ └── file3.js │ │ │ └── index.js │ │ ├── filename │ │ │ └── index.js │ │ ├── harmony-export-precedence │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── d.js │ │ │ └── index.js │ │ ├── harmony │ │ │ ├── index.js │ │ │ └── node_modules │ │ │ │ ├── abc.js │ │ │ │ ├── abc_c.js │ │ │ │ ├── circularEven.js │ │ │ │ ├── circularOdd.js │ │ │ │ ├── commonjs-trans.js │ │ │ │ ├── commonjs.js │ │ │ │ ├── def.js │ │ │ │ ├── exportKinds.js │ │ │ │ ├── exports-specifier.js │ │ │ │ └── reexport.js │ │ ├── hot-api │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ └── index.js │ │ ├── hot-error-handler │ │ │ └── index.js │ │ ├── hot-hash │ │ │ └── index.js │ │ ├── inject-free-vars │ │ │ ├── fail.js │ │ │ ├── index.js │ │ │ └── x1.js │ │ ├── issue-1044 │ │ │ └── index.js │ │ ├── issue-1600 │ │ │ ├── file.js │ │ │ └── index.js │ │ ├── issue-345 │ │ │ ├── abc │ │ │ │ └── abcTest.js │ │ │ └── index.js │ │ ├── issue-387 │ │ │ ├── file.js │ │ │ └── index.js │ │ ├── issue-494 │ │ │ └── index.js │ │ ├── issue-551 │ │ │ └── index.js │ │ ├── issue-627 │ │ │ ├── dir │ │ │ │ └── test.js │ │ │ ├── index.js │ │ │ └── warnings.js │ │ ├── javascript │ │ │ └── index.js │ │ ├── local-modules │ │ │ ├── dep.js │ │ │ └── index.js │ │ ├── renaming │ │ │ ├── file.js │ │ │ └── index.js │ │ ├── requirejs │ │ │ └── index.js │ │ ├── typeof │ │ │ ├── errorfile.js │ │ │ ├── index.js │ │ │ └── typeof.js │ │ └── var-hiding │ │ │ └── index.js │ ├── resolving │ │ ├── browser-field │ │ │ ├── errors.js │ │ │ ├── index.js │ │ │ └── node_modules │ │ │ │ ├── ignoring-module │ │ │ │ ├── file.js │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ │ ├── new-module │ │ │ │ ├── index.js │ │ │ │ └── inner.js │ │ │ │ ├── recursive-file │ │ │ │ ├── a.js │ │ │ │ ├── b.js │ │ │ │ ├── c.js │ │ │ │ ├── d.js │ │ │ │ └── package.json │ │ │ │ ├── recursive-module │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ │ ├── replacing-file1 │ │ │ │ ├── file.js │ │ │ │ ├── index.js │ │ │ │ ├── new-file.js │ │ │ │ └── package.json │ │ │ │ ├── replacing-file2 │ │ │ │ ├── file.js │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ │ ├── replacing-file3 │ │ │ │ ├── file.js │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ │ ├── replacing-file4 │ │ │ │ ├── dir │ │ │ │ │ ├── file.js │ │ │ │ │ ├── index.js │ │ │ │ │ └── new-file.js │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ │ ├── replacing-module1 │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ │ ├── replacing-module2 │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ │ ├── replacing-module3 │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ │ ├── replacing-module4 │ │ │ │ ├── index.js │ │ │ │ ├── module.js │ │ │ │ └── package.json │ │ │ │ └── wrong-module.js │ │ ├── context │ │ │ ├── index.js │ │ │ ├── loaders │ │ │ │ └── queryloader.js │ │ │ └── node_modules │ │ │ │ └── subcontent │ │ │ │ ├── index.js │ │ │ │ └── test.jade │ │ ├── query │ │ │ ├── empty.js │ │ │ └── index.js │ │ └── single-file-module │ │ │ ├── index.js │ │ │ └── node_modules │ │ │ └── subfilemodule.js │ └── runtime │ │ ├── chunk-callback-order │ │ ├── a.js │ │ ├── b.js │ │ ├── duplicate.js │ │ ├── duplicate2.js │ │ └── index.js │ │ ├── circular-dependencies │ │ ├── circular.js │ │ ├── circular2.js │ │ └── index.js │ │ ├── error-handling │ │ ├── errors.js │ │ ├── folder │ │ │ ├── file1.js │ │ │ ├── file2.js │ │ │ └── file3.js │ │ ├── index.js │ │ └── warnings.js │ │ ├── issue-1788 │ │ ├── a.js │ │ ├── b.js │ │ └── index.js │ │ ├── missing-module-exception │ │ ├── index.js │ │ └── warnings.js │ │ ├── module-caching │ │ ├── index.js │ │ ├── singluar.js │ │ ├── singluar2.js │ │ └── two.js │ │ └── require-function │ │ ├── fail.js │ │ └── index.js ├── checkArrayExpectation.js ├── configCases │ ├── additional-pass │ │ └── simple │ │ │ ├── index.js │ │ │ └── webpack.config.js │ ├── async-commons-chunk │ │ ├── duplicate │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── d.js │ │ │ ├── e.js │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ ├── nested │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── d.js │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ └── simple │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── index.js │ │ │ └── webpack.config.js │ ├── context-replacement │ │ ├── a │ │ │ ├── index.js │ │ │ ├── new-context │ │ │ │ └── node_modules │ │ │ │ │ ├── error.js │ │ │ │ │ └── replaced.js │ │ │ ├── warnings.js │ │ │ └── webpack.config.js │ │ └── b │ │ │ ├── error.js │ │ │ ├── index.js │ │ │ ├── only-this.js │ │ │ ├── warnings.js │ │ │ └── webpack.config.js │ ├── dedupe │ │ └── in-chunk │ │ │ ├── a │ │ │ └── dedupe.js │ │ │ ├── b │ │ │ └── dedupe.js │ │ │ ├── index.js │ │ │ └── webpack.config.js │ ├── delegated │ │ └── simple │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── bundle.js │ │ │ ├── dir │ │ │ └── c.js │ │ │ ├── index.js │ │ │ ├── loader.js │ │ │ └── webpack.config.js │ ├── entry │ │ ├── issue-1068 │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── d.js │ │ │ ├── e.js │ │ │ ├── f.js │ │ │ ├── g.js │ │ │ ├── h.js │ │ │ ├── i.js │ │ │ ├── j.js │ │ │ ├── k.js │ │ │ ├── test.js │ │ │ └── webpack.config.js │ │ └── require-entry-point │ │ │ ├── entry-point.js │ │ │ ├── entry-point2.js │ │ │ ├── require-entry-point.js │ │ │ └── webpack.config.js │ ├── errors │ │ └── entry-not-found │ │ │ ├── errors.js │ │ │ └── webpack.config.js │ ├── externals │ │ ├── optional-externals-cjs │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ ├── optional-externals-root │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ ├── optional-externals-umd │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ ├── optional-externals-umd2-mixed │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ └── optional-externals-umd2 │ │ │ ├── index.js │ │ │ └── webpack.config.js │ ├── extract-text │ │ └── issue-14 │ │ │ ├── base.css │ │ │ ├── index.js │ │ │ ├── styleA.css │ │ │ ├── styleB.css │ │ │ └── webpack.config.js │ ├── filename-template │ │ └── module-filename-template │ │ │ ├── index.js │ │ │ ├── test.js │ │ │ └── webpack.config.js │ ├── hash-length │ │ ├── hashed-module-ids │ │ │ ├── files │ │ │ │ ├── file1.js │ │ │ │ ├── file10.js │ │ │ │ ├── file11.js │ │ │ │ ├── file12.js │ │ │ │ ├── file13.js │ │ │ │ ├── file14.js │ │ │ │ ├── file15.js │ │ │ │ ├── file2.js │ │ │ │ ├── file3.js │ │ │ │ ├── file4.js │ │ │ │ ├── file5.js │ │ │ │ ├── file6.js │ │ │ │ ├── file7.js │ │ │ │ ├── file8.js │ │ │ │ └── file9.js │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ └── output-filename │ │ │ ├── chunk.js │ │ │ ├── index.js │ │ │ ├── test.config.js │ │ │ └── webpack.config.js │ ├── library │ │ ├── a │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ └── b │ │ │ ├── index.js │ │ │ └── webpack.config.js │ ├── parsing │ │ ├── context │ │ │ ├── index.js │ │ │ ├── warnings.js │ │ │ └── webpack.config.js │ │ ├── extended-api │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ ├── issue-336 │ │ │ ├── index.js │ │ │ ├── node_modules │ │ │ │ └── aaa.js │ │ │ └── webpack.config.js │ │ ├── relative-filedirname │ │ │ ├── dir │ │ │ │ └── file.js │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ └── require.main │ │ │ ├── index.js │ │ │ └── webpack.config.js │ ├── plugins │ │ ├── banner-plugin │ │ │ ├── index.js │ │ │ ├── test.js │ │ │ ├── vendors.js │ │ │ └── webpack.config.js │ │ ├── define-plugin │ │ │ ├── a.js │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ ├── environment-plugin │ │ │ ├── errors.js │ │ │ ├── index.js │ │ │ ├── warnings.js │ │ │ └── webpack.config.js │ │ ├── lib-manifest-plugin │ │ │ ├── a.js │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ ├── loader-options-plugin │ │ │ ├── index.js │ │ │ ├── loader.js │ │ │ ├── txt.txt │ │ │ └── webpack.config.js │ │ ├── new-watching-plugin │ │ │ ├── index.js │ │ │ ├── warnings.js │ │ │ └── webpack.config.js │ │ ├── provide-plugin │ │ │ ├── aaa.js │ │ │ ├── bbbccc.js │ │ │ ├── env.js │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ ├── uglifyjs-plugin │ │ │ ├── index.js │ │ │ ├── test.js │ │ │ ├── vendors.js │ │ │ └── webpack.config.js │ │ └── watch-ignore-plugin │ │ │ ├── index.js │ │ │ └── webpack.config.js │ ├── records │ │ └── issue-295 │ │ │ ├── file.js │ │ │ ├── loader.js │ │ │ ├── test.js │ │ │ └── webpack.config.js │ ├── simple │ │ ├── empty-config │ │ │ ├── index.js │ │ │ └── webpack.config.js │ │ └── multi-compiler │ │ │ ├── index.js │ │ │ └── webpack.config.js │ ├── source-map │ │ ├── exclude-chunks-source-map │ │ │ ├── index.js │ │ │ ├── test.js │ │ │ ├── vendors.js │ │ │ └── webpack.config.js │ │ ├── line-to-line │ │ │ ├── index.js │ │ │ ├── test.js │ │ │ └── webpack.config.js │ │ ├── relative-source-map-path │ │ │ ├── index.js │ │ │ ├── test.js │ │ │ └── webpack.config.js │ │ ├── sources-array-production-cheap-map │ │ │ ├── index.js │ │ │ ├── test.js │ │ │ └── webpack.config.js │ │ └── sources-array-production │ │ │ ├── index.js │ │ │ ├── test.js │ │ │ └── webpack.config.js │ └── target │ │ ├── buffer-default │ │ ├── index.js │ │ └── webpack.config.js │ │ ├── buffer │ │ ├── index.js │ │ └── webpack.config.js │ │ ├── umd-named-define │ │ ├── index.js │ │ └── webpack.config.js │ │ └── web │ │ ├── index.js │ │ ├── node_modules │ │ └── process │ │ │ ├── in.js │ │ │ └── index.js │ │ └── webpack.config.js ├── fixtures │ ├── a.js │ ├── abc.js │ ├── abc.txt │ ├── b.js │ ├── c.js │ ├── chunks.js │ ├── complex.js │ ├── errors │ │ ├── case-sensitive.js │ │ ├── entry-point.js │ │ ├── file.js │ │ ├── missingFile.js │ │ └── require.extensions.js │ ├── items │ │ ├── item (0).js │ │ ├── item (1).js │ │ ├── item (2).js │ │ ├── item (3).js │ │ ├── item (4).js │ │ ├── item (5).js │ │ ├── item (6).js │ │ ├── item (7).js │ │ ├── item (8).js │ │ └── item (9).js │ ├── lib │ │ └── complex1.js │ ├── main1.js │ ├── main2.js │ ├── main3.js │ ├── main4.js │ ├── node_modules │ │ ├── complexm │ │ │ ├── step1.js │ │ │ ├── step2.js │ │ │ └── web_modules │ │ │ │ └── m1 │ │ │ │ ├── a.js │ │ │ │ └── index.js │ │ ├── m1 │ │ │ ├── a.js │ │ │ └── b.js │ │ ├── m2-loader │ │ │ └── b.js │ │ └── m2 │ │ │ └── b.js │ ├── nodetest │ │ ├── entry.js │ │ ├── file456.js │ │ └── file567.js │ ├── subdir │ │ └── watched-file.txt │ └── watched-file.txt ├── hotCases │ ├── fake-update-loader.js │ ├── harmony │ │ ├── auto-import-multiple │ │ │ ├── commonjs.js │ │ │ ├── file.js │ │ │ └── index.js │ │ └── auto-import │ │ │ ├── file.js │ │ │ └── index.js │ ├── runtime │ │ ├── accept │ │ │ ├── file.js │ │ │ └── index.js │ │ ├── bubble-update │ │ │ ├── file.js │ │ │ ├── index.js │ │ │ └── parent-file.js │ │ ├── self-accept-and-dispose │ │ │ ├── file.js │ │ │ └── index.js │ │ ├── update-multiple-modules │ │ │ ├── fileA.js │ │ │ ├── fileB.js │ │ │ ├── index.js │ │ │ └── parent-file.js │ │ └── update-multiple-times │ │ │ ├── file.js │ │ │ └── index.js │ └── update.js ├── hotPlayground │ ├── .gitignore │ ├── addStyle.js │ ├── applyStyle2.js │ ├── element-dependency.js │ ├── element.js │ ├── html.js │ ├── index.html │ ├── index.js │ ├── style.js │ ├── style2.js │ └── webpack.config.js └── statsCases │ ├── chunks │ ├── a.js │ ├── b.js │ ├── c.js │ ├── d.js │ ├── e.js │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── color-disabled │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── color-enabled-custom │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── color-enabled │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── define-plugin │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── external │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── preset-errors-only-error │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── preset-errors-only │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── preset-minimal-simple │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── preset-minimal │ ├── a.js │ ├── b.js │ ├── c.js │ ├── d.js │ ├── e.js │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── preset-none-error │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── preset-none │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── preset-normal │ ├── a.js │ ├── b.js │ ├── c.js │ ├── d.js │ ├── e.js │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── preset-verbose │ ├── a.js │ ├── b.js │ ├── c.js │ ├── d.js │ ├── e.js │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ ├── simple-more-info │ ├── expected.txt │ ├── index.js │ └── webpack.config.js │ └── simple │ ├── expected.txt │ └── index.js └── web_modules └── node-libs-browser.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.js] 4 | indent_style=tab 5 | trim_trailing_whitespace=true -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | test/statsCases/* eol=lf 3 | examples/* eol=lf 4 | bin/* eol=lf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /test/js 3 | /test/browsertest/js 4 | /benchmark/js 5 | /benchmark/fixtures 6 | /examples/*/js 7 | /coverage 8 | .DS_Store 9 | *.log 10 | -------------------------------------------------------------------------------- /buildin/amd-define.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { throw new Error("define cannot be used indirect"); }; 2 | -------------------------------------------------------------------------------- /buildin/amd-options.js: -------------------------------------------------------------------------------- 1 | module.exports = __webpack_amd_options__; 2 | -------------------------------------------------------------------------------- /buildin/module.js: -------------------------------------------------------------------------------- 1 | module.exports = function(module) { 2 | if(!module.webpackPolyfill) { 3 | module.deprecate = function() {}; 4 | module.paths = []; 5 | // module.parent = undefined by default 6 | module.children = []; 7 | module.webpackPolyfill = 1; 8 | } 9 | return module; 10 | } 11 | -------------------------------------------------------------------------------- /buildin/return-require.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { return __webpack_require__; }; -------------------------------------------------------------------------------- /examples/agressive-merging/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /examples/agressive-merging/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /examples/agressive-merging/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); 3 | -------------------------------------------------------------------------------- /examples/agressive-merging/pageA.js: -------------------------------------------------------------------------------- 1 | require(["./common"], function(common) { 2 | common(require("./a")); 3 | }); -------------------------------------------------------------------------------- /examples/agressive-merging/pageB.js: -------------------------------------------------------------------------------- 1 | require(["./common"], function(common) { 2 | common(require("./b")); 3 | }); -------------------------------------------------------------------------------- /examples/agressive-merging/pageC.js: -------------------------------------------------------------------------------- 1 | require(["./a"], function(a) { 2 | console.log(a + require("./b")); 3 | }); -------------------------------------------------------------------------------- /examples/chunkhash/async1.js: -------------------------------------------------------------------------------- 1 | // some async loaded module 2 | -------------------------------------------------------------------------------- /examples/chunkhash/async2.js: -------------------------------------------------------------------------------- 1 | // some async loaded module 2 | -------------------------------------------------------------------------------- /examples/chunkhash/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); -------------------------------------------------------------------------------- /examples/chunkhash/example.js: -------------------------------------------------------------------------------- 1 | import vendor from "./vendor"; 2 | // some module 3 | System.import("./async1"); 4 | System.import("./async2"); 5 | -------------------------------------------------------------------------------- /examples/chunkhash/vendor.js: -------------------------------------------------------------------------------- 1 | // some vendor lib (should be in common chunk) 2 | export default 123; 3 | -------------------------------------------------------------------------------- /examples/code-splitted-css-bundle/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/code-splitted-css-bundle/chunk.js: -------------------------------------------------------------------------------- 1 | require("./style2.css"); 2 | -------------------------------------------------------------------------------- /examples/code-splitted-css-bundle/example.js: -------------------------------------------------------------------------------- 1 | require("./style.css"); 2 | require(["./chunk"]); 3 | -------------------------------------------------------------------------------- /examples/code-splitted-css-bundle/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/code-splitted-css-bundle/image.png -------------------------------------------------------------------------------- /examples/code-splitted-css-bundle/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/code-splitted-css-bundle/image2.png -------------------------------------------------------------------------------- /examples/code-splitted-css-bundle/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: url(image.png); 3 | } 4 | -------------------------------------------------------------------------------- /examples/code-splitted-css-bundle/style2.css: -------------------------------------------------------------------------------- 1 | .xyz { 2 | background: url(image2.png); 3 | } 4 | -------------------------------------------------------------------------------- /examples/code-splitted-css-bundle/webpack.config.js: -------------------------------------------------------------------------------- 1 | var ExtractTextPlugin = require("extract-text-webpack-plugin"); 2 | module.exports = { 3 | module: { 4 | loaders: [ 5 | { 6 | test: /\.css$/, 7 | loader: ExtractTextPlugin.extract("style-loader", "css-loader") 8 | }, 9 | { test: /\.png$/, loader: "file-loader" } 10 | ] 11 | }, 12 | plugins: [ 13 | new ExtractTextPlugin("style.css") 14 | ] 15 | }; -------------------------------------------------------------------------------- /examples/code-splitted-dedupe/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/code-splitted-dedupe/example.js: -------------------------------------------------------------------------------- 1 | // index.js and x.js can be deduplicated 2 | require(["../dedupe/a", "bundle?lazy!../dedupe/b"]); 3 | 4 | // index.js and x.js cannot be deduplicated 5 | require(["../dedupe/a"]); 6 | require(["../dedupe/b"]); 7 | -------------------------------------------------------------------------------- /examples/code-splitted-dedupe/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../"); 2 | module.exports = { 3 | plugins: [ 4 | new webpack.optimize.DedupePlugin() 5 | ] 6 | } -------------------------------------------------------------------------------- /examples/code-splitted-require.context-amd/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/code-splitted-require.context-amd/example.js: -------------------------------------------------------------------------------- 1 | function getTemplate(templateName, callback) { 2 | require(["../require.context/templates/"+templateName], function(tmpl) { 3 | callback(tmpl()); 4 | }); 5 | } 6 | getTemplate("a", function(a) { 7 | console.log(a); 8 | }); 9 | getTemplate("b", function(b) { 10 | console.log(b); 11 | }); -------------------------------------------------------------------------------- /examples/code-splitted-require.context-amd/template.md: -------------------------------------------------------------------------------- 1 | # example.js 2 | 3 | ``` javascript 4 | {{example.js}} 5 | ``` 6 | 7 | # js/output.js 8 | 9 | ``` javascript 10 | {{js/output.js}} 11 | ``` 12 | 13 | # js/1.output.js 14 | 15 | ``` javascript 16 | {{js/1.output.js}} 17 | ``` 18 | 19 | # Info 20 | 21 | ## Uncompressed 22 | 23 | ``` 24 | {{stdout}} 25 | ``` 26 | 27 | ## Minimized (uglify-js, no zip) 28 | 29 | ``` 30 | {{min:stdout}} 31 | ``` 32 | -------------------------------------------------------------------------------- /examples/code-splitted-require.context/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/code-splitted-require.context/example.js: -------------------------------------------------------------------------------- 1 | function getTemplate(templateName, callback) { 2 | require.ensure([], function(require) { 3 | callback(require("../require.context/templates/"+templateName)()); 4 | }); 5 | } 6 | getTemplate("a", function(a) { 7 | console.log(a); 8 | }); 9 | getTemplate("b", function(b) { 10 | console.log(b); 11 | }); -------------------------------------------------------------------------------- /examples/code-splitted-require.context/template.md: -------------------------------------------------------------------------------- 1 | # example.js 2 | 3 | ``` javascript 4 | {{example.js}} 5 | ``` 6 | 7 | # js/output.js 8 | 9 | ``` javascript 10 | {{js/output.js}} 11 | ``` 12 | 13 | # js/1.output.js 14 | 15 | ``` javascript 16 | {{js/1.output.js}} 17 | ``` 18 | 19 | # Info 20 | 21 | ## Uncompressed 22 | 23 | ``` 24 | {{stdout}} 25 | ``` 26 | 27 | ## Minimized (uglify-js, no zip) 28 | 29 | ``` 30 | {{min:stdout}} 31 | ``` 32 | -------------------------------------------------------------------------------- /examples/code-splitting-bundle-loader/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/code-splitting-bundle-loader/example.js: -------------------------------------------------------------------------------- 1 | require("bundle!./file.js")(function(fileJsExports) { 2 | console.log(fileJsExports); 3 | }); -------------------------------------------------------------------------------- /examples/code-splitting-bundle-loader/file.js: -------------------------------------------------------------------------------- 1 | module.exports = "It works"; -------------------------------------------------------------------------------- /examples/code-splitting-harmony/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/code-splitting-harmony/example.js: -------------------------------------------------------------------------------- 1 | import a from "a"; 2 | 3 | System.import("b").then(function(b) { 4 | console.log("b loaded", b); 5 | }) 6 | 7 | function loadC(name) { 8 | return System.import("c/" + name) 9 | } 10 | 11 | Promise.all([loadC("1"), loadC("2")]).then(function(arr) { 12 | console.log("c/1 and c/2 loaded", arr); 13 | }); 14 | -------------------------------------------------------------------------------- /examples/code-splitting-harmony/node_modules/a.js: -------------------------------------------------------------------------------- 1 | // module a -------------------------------------------------------------------------------- /examples/code-splitting-harmony/node_modules/b.js: -------------------------------------------------------------------------------- 1 | // module b -------------------------------------------------------------------------------- /examples/code-splitting-harmony/node_modules/c/1.js: -------------------------------------------------------------------------------- 1 | // module c/1 -------------------------------------------------------------------------------- /examples/code-splitting-harmony/node_modules/c/2.js: -------------------------------------------------------------------------------- 1 | // module c/2 -------------------------------------------------------------------------------- /examples/code-splitting/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/code-splitting/example.js: -------------------------------------------------------------------------------- 1 | var a = require("a"); 2 | var b = require("b"); 3 | require.ensure(["c"], function(require) { 4 | require("b").xyz(); 5 | var d = require("d"); 6 | }); -------------------------------------------------------------------------------- /examples/code-splitting/node_modules/a.js: -------------------------------------------------------------------------------- 1 | // module a -------------------------------------------------------------------------------- /examples/code-splitting/node_modules/b.js: -------------------------------------------------------------------------------- 1 | // module b -------------------------------------------------------------------------------- /examples/code-splitting/node_modules/c.js: -------------------------------------------------------------------------------- 1 | // module c -------------------------------------------------------------------------------- /examples/code-splitting/node_modules/d.js: -------------------------------------------------------------------------------- 1 | // module d -------------------------------------------------------------------------------- /examples/coffee-script/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/coffee-script/cup1.coffee: -------------------------------------------------------------------------------- 1 | module.exports = 2 | cool: "stuff" 3 | answer: 42 4 | external: require "./cup2.coffee" 5 | again: require "./cup2" -------------------------------------------------------------------------------- /examples/coffee-script/cup2.coffee: -------------------------------------------------------------------------------- 1 | console.log "yeah coffee-script" 2 | 3 | module.exports = 42 4 | -------------------------------------------------------------------------------- /examples/coffee-script/example.js: -------------------------------------------------------------------------------- 1 | console.log(require("./cup1")); -------------------------------------------------------------------------------- /examples/coffee-script/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | module: { 3 | loaders: [ 4 | { test: /\.coffee$/, loader: "coffee" } 5 | ] 6 | }, 7 | resolve: { 8 | extensions: ["", ".web.coffee", ".web.js", ".coffee", ".js"] 9 | } 10 | } -------------------------------------------------------------------------------- /examples/commonjs/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/commonjs/example.js: -------------------------------------------------------------------------------- 1 | var inc = require('./increment').increment; 2 | var a = 1; 3 | inc(a); // 2 -------------------------------------------------------------------------------- /examples/commonjs/increment.js: -------------------------------------------------------------------------------- 1 | var add = require('./math').add; 2 | exports.increment = function(val) { 3 | return add(val, 1); 4 | }; -------------------------------------------------------------------------------- /examples/commonjs/math.js: -------------------------------------------------------------------------------- 1 | exports.add = function() { 2 | var sum = 0, i = 0, args = arguments, l = args.length; 3 | while (i < l) { 4 | sum += args[i++]; 5 | } 6 | return sum; 7 | }; -------------------------------------------------------------------------------- /examples/css-bundle/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/css-bundle/example.js: -------------------------------------------------------------------------------- 1 | require("./style.css"); -------------------------------------------------------------------------------- /examples/css-bundle/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/css-bundle/image.png -------------------------------------------------------------------------------- /examples/css-bundle/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: url(image.png); 3 | } -------------------------------------------------------------------------------- /examples/css-bundle/webpack.config.js: -------------------------------------------------------------------------------- 1 | var ExtractTextPlugin = require("extract-text-webpack-plugin"); 2 | module.exports = { 3 | module: { 4 | loaders: [ 5 | { 6 | test: /\.css$/, 7 | loader: ExtractTextPlugin.extract("css-loader") 8 | }, 9 | { test: /\.png$/, loader: "file-loader" } 10 | ] 11 | }, 12 | plugins: [ 13 | new ExtractTextPlugin("style.css", { allChunks: true }) 14 | ] 15 | }; -------------------------------------------------------------------------------- /examples/dedupe/a/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | x: require("./x"), 3 | y: require("./y"), 4 | z: require("../z") 5 | } -------------------------------------------------------------------------------- /examples/dedupe/a/x.js: -------------------------------------------------------------------------------- 1 | module.exports = {"this is": "x"}; -------------------------------------------------------------------------------- /examples/dedupe/a/y.js: -------------------------------------------------------------------------------- 1 | module.exports = {"this is": "y", "but in": "a"}; -------------------------------------------------------------------------------- /examples/dedupe/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | x: require("./x"), 3 | y: require("./y"), 4 | z: require("../z") 5 | } -------------------------------------------------------------------------------- /examples/dedupe/b/x.js: -------------------------------------------------------------------------------- 1 | module.exports = {"this is": "x"}; -------------------------------------------------------------------------------- /examples/dedupe/b/y.js: -------------------------------------------------------------------------------- 1 | module.exports = {"this is": "y", "but in": "b"}; -------------------------------------------------------------------------------- /examples/dedupe/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/dedupe/example.js: -------------------------------------------------------------------------------- 1 | var a = require("./a"); 2 | var b = require("./b"); 3 | a.x !== b.x; 4 | a.y !== b.y; -------------------------------------------------------------------------------- /examples/dedupe/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../"); 2 | module.exports = { 3 | plugins: [ 4 | new webpack.optimize.DedupePlugin() 5 | ] 6 | } -------------------------------------------------------------------------------- /examples/dedupe/z.js: -------------------------------------------------------------------------------- 1 | module.exports = {"this is": "z"}; -------------------------------------------------------------------------------- /examples/dll-user/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/dll-user/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/dll-user/example.js: -------------------------------------------------------------------------------- 1 | console.log(require("../dll/alpha")); 2 | console.log(require("../dll/a")); 3 | 4 | console.log(require("beta/beta")); 5 | console.log(require("beta/b")); 6 | 7 | console.log(require("module")); 8 | -------------------------------------------------------------------------------- /examples/dll-user/template.md: -------------------------------------------------------------------------------- 1 | # webpack.config.js 2 | 3 | ``` javascript 4 | {{webpack.config.js}} 5 | ``` 6 | 7 | # example.js 8 | 9 | ``` javascript 10 | {{example.js}} 11 | ``` 12 | 13 | # js/output.js 14 | 15 | ``` javascript 16 | {{js/output.js}} 17 | ``` 18 | 19 | # Info 20 | 21 | ## Uncompressed 22 | 23 | ``` 24 | {{stdout}} 25 | ``` 26 | 27 | ## Minimized (uglify-js, no zip) 28 | 29 | ``` 30 | {{min:stdout}} 31 | ``` -------------------------------------------------------------------------------- /examples/dll-user/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | var webpack = require("../../"); 3 | module.exports = { 4 | plugins: [ 5 | new webpack.DllReferencePlugin({ 6 | context: path.join(__dirname, "..", "dll"), 7 | manifest: require("../dll/js/alpha-manifest.json") 8 | }), 9 | new webpack.DllReferencePlugin({ 10 | scope: "beta", 11 | manifest: require("../dll/js/beta-manifest.json") 12 | }) 13 | ] 14 | }; 15 | -------------------------------------------------------------------------------- /examples/dll/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /examples/dll/alpha.js: -------------------------------------------------------------------------------- 1 | module.exports = "alpha"; -------------------------------------------------------------------------------- /examples/dll/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /examples/dll/beta.js: -------------------------------------------------------------------------------- 1 | module.exports = "beta"; -------------------------------------------------------------------------------- /examples/dll/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); -------------------------------------------------------------------------------- /examples/dll/template.md: -------------------------------------------------------------------------------- 1 | # webpack.config.js 2 | 3 | ``` javascript 4 | {{webpack.config.js}} 5 | ``` 6 | 7 | # js/MyDll.alpha.js 8 | 9 | ``` javascript 10 | {{js/MyDll.alpha.js}} 11 | ``` 12 | 13 | # js/alpha-manifest.json 14 | 15 | ``` javascript 16 | {{js/alpha-manifest.json}} 17 | ``` 18 | 19 | # Info 20 | 21 | ## Uncompressed 22 | 23 | ``` 24 | {{stdout}} 25 | ``` 26 | 27 | ## Minimized (uglify-js, no zip) 28 | 29 | ``` 30 | {{min:stdout}} 31 | ``` -------------------------------------------------------------------------------- /examples/explicit-vendor-chunk/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); 3 | -------------------------------------------------------------------------------- /examples/explicit-vendor-chunk/pageA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/explicit-vendor-chunk/pageA.js: -------------------------------------------------------------------------------- 1 | module.exports = "pageA"; -------------------------------------------------------------------------------- /examples/explicit-vendor-chunk/pageB.js: -------------------------------------------------------------------------------- 1 | module.exports = "pageB"; -------------------------------------------------------------------------------- /examples/explicit-vendor-chunk/pageC.js: -------------------------------------------------------------------------------- 1 | module.exports = "pageC"; -------------------------------------------------------------------------------- /examples/explicit-vendor-chunk/template.md: -------------------------------------------------------------------------------- 1 | # webpack.config.js 2 | 3 | ``` javascript 4 | {{webpack.config.js}} 5 | ``` 6 | 7 | # js/vendor.js 8 | 9 | ``` javascript 10 | {{js/vendor.js}} 11 | ``` 12 | 13 | # js/pageA.js 14 | 15 | ``` javascript 16 | {{js/pageA.js}} 17 | ``` 18 | 19 | # Info 20 | 21 | ## Uncompressed 22 | 23 | ``` 24 | {{stdout}} 25 | ``` 26 | 27 | ## Minimized (uglify-js, no zip) 28 | 29 | ``` 30 | {{min:stdout}} 31 | ``` 32 | -------------------------------------------------------------------------------- /examples/explicit-vendor-chunk/vendor.js: -------------------------------------------------------------------------------- 1 | module.exports = "Vendor"; -------------------------------------------------------------------------------- /examples/externals/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/externals/example.js: -------------------------------------------------------------------------------- 1 | var add = require("add"); 2 | var subtract = require("subtract"); 3 | 4 | exports.exampleValue = subtract(add(42, 2), 2); -------------------------------------------------------------------------------- /examples/externals/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | libraryTarget: "umd" 4 | }, 5 | externals: [ 6 | "add", 7 | { 8 | "subtract": { 9 | root: "subtract", 10 | commonjs2: "./subtract", 11 | commonjs: ["./math", "subtract"], 12 | amd: "subtract" 13 | } 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /examples/extra-async-chunk-advanced/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /examples/extra-async-chunk-advanced/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /examples/extra-async-chunk-advanced/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/extra-async-chunk-advanced/c.js: -------------------------------------------------------------------------------- 1 | module.exports = "c"; -------------------------------------------------------------------------------- /examples/extra-async-chunk-advanced/d.js: -------------------------------------------------------------------------------- 1 | module.exports = "d"; -------------------------------------------------------------------------------- /examples/extra-async-chunk-advanced/e.js: -------------------------------------------------------------------------------- 1 | module.exports = "e"; -------------------------------------------------------------------------------- /examples/extra-async-chunk-advanced/example.js: -------------------------------------------------------------------------------- 1 | require(["./a", "./b", "./c"], function(a, b, c) {}); 2 | 3 | require.ensure(["./a"], function(require) { 4 | require("./b"); 5 | require("./d"); 6 | }); 7 | 8 | require.ensure(["./a", "./e"], function(require) { 9 | require("./a"); 10 | require.ensure(["./b"], function(require) { 11 | require("./f"); 12 | }); 13 | require.ensure(["./b"], function(require) { 14 | require("./g"); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /examples/extra-async-chunk-advanced/f.js: -------------------------------------------------------------------------------- 1 | module.exports = "f"; -------------------------------------------------------------------------------- /examples/extra-async-chunk-advanced/g.js: -------------------------------------------------------------------------------- 1 | module.exports = "g"; -------------------------------------------------------------------------------- /examples/extra-async-chunk/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /examples/extra-async-chunk/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /examples/extra-async-chunk/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/extra-async-chunk/c.js: -------------------------------------------------------------------------------- 1 | module.exports = "c"; -------------------------------------------------------------------------------- /examples/extra-async-chunk/d.js: -------------------------------------------------------------------------------- 1 | module.exports = "d"; -------------------------------------------------------------------------------- /examples/extra-async-chunk/example.js: -------------------------------------------------------------------------------- 1 | // a chunks with a, b, c 2 | require(["./a", "./b", "./c"], function(a, b, c) {}); 3 | 4 | // a chunk with a, b, d 5 | require.ensure(["./a"], function(require) { 6 | require("./b"); 7 | require("./d"); 8 | }); 9 | -------------------------------------------------------------------------------- /examples/harmony-unused/abc.js: -------------------------------------------------------------------------------- 1 | export function a() { console.log("a"); } 2 | export function b() { console.log("b"); } 3 | export function c() { console.log("c"); } 4 | -------------------------------------------------------------------------------- /examples/harmony-unused/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/harmony-unused/example.js: -------------------------------------------------------------------------------- 1 | import { add } from './math'; 2 | import { reexportedMultiply } from "./library"; 3 | 4 | add(1, 2); 5 | reexportedMultiply(1, 2); 6 | -------------------------------------------------------------------------------- /examples/harmony-unused/library.js: -------------------------------------------------------------------------------- 1 | export { a, b, c } from "./abc"; 2 | export { add as reexportedAdd, multiply as reexportedMultiply } from "./math"; -------------------------------------------------------------------------------- /examples/harmony-unused/math.js: -------------------------------------------------------------------------------- 1 | export function add() { 2 | var sum = 0, i = 0, args = arguments, l = args.length; 3 | while (i < l) { 4 | sum += args[i++]; 5 | } 6 | return sum; 7 | } 8 | 9 | export function multiply() { 10 | var product = 1, i = 0, args = arguments, l = args.length; 11 | while (i < l) { 12 | product *= args[i++]; 13 | } 14 | return product; 15 | } 16 | 17 | export function list() { 18 | return Array.from(arguments); 19 | } 20 | -------------------------------------------------------------------------------- /examples/harmony/async-loaded.js: -------------------------------------------------------------------------------- 1 | export var answer = 42; 2 | -------------------------------------------------------------------------------- /examples/harmony/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/harmony/example.js: -------------------------------------------------------------------------------- 1 | import { increment as inc } from './increment'; 2 | var a = 1; 3 | inc(a); // 2 4 | 5 | // async loading 6 | System.import("./async-loaded").then(function(asyncLoaded) { 7 | console.log(asyncLoaded); 8 | }); 9 | -------------------------------------------------------------------------------- /examples/harmony/increment.js: -------------------------------------------------------------------------------- 1 | import { add } from './math'; 2 | export function increment(val) { 3 | return add(val, 1); 4 | }; 5 | -------------------------------------------------------------------------------- /examples/harmony/math.js: -------------------------------------------------------------------------------- 1 | export function add() { 2 | var sum = 0, i = 0, args = arguments, l = args.length; 3 | while (i < l) { 4 | sum += args[i++]; 5 | } 6 | return sum; 7 | } 8 | -------------------------------------------------------------------------------- /examples/harmony/template.md: -------------------------------------------------------------------------------- 1 | 2 | # example.js 3 | 4 | ``` javascript 5 | {{example.js}} 6 | ``` 7 | 8 | # increment.js 9 | 10 | ``` javascript 11 | {{increment.js}} 12 | ``` 13 | 14 | # js/output.js 15 | 16 | ``` javascript 17 | {{js/output.js}} 18 | ``` 19 | 20 | # Info 21 | 22 | ## Uncompressed 23 | 24 | ``` 25 | {{stdout}} 26 | ``` 27 | 28 | ## Minimized (uglify-js, no zip) 29 | 30 | ``` 31 | {{min:stdout}} 32 | ``` -------------------------------------------------------------------------------- /examples/hybrid-routing/aEntry.js: -------------------------------------------------------------------------------- 1 | // Just show the page "a" 2 | var render = require("./render"); 3 | render(require("./aPage")); -------------------------------------------------------------------------------- /examples/hybrid-routing/aPage.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return "This is page A."; 3 | }; -------------------------------------------------------------------------------- /examples/hybrid-routing/bEntry.js: -------------------------------------------------------------------------------- 1 | // Just show the page "b" 2 | var render = require("./render"); 3 | render(require("./bPage")); -------------------------------------------------------------------------------- /examples/hybrid-routing/bPage.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return "This is page B."; 3 | }; -------------------------------------------------------------------------------- /examples/hybrid-routing/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); 3 | -------------------------------------------------------------------------------- /examples/hybrid-routing/pageA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/hybrid-routing/pageB.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/hybrid-routing/render.js: -------------------------------------------------------------------------------- 1 | module.exports = function(page) { 2 | console.log(page()); 3 | }; -------------------------------------------------------------------------------- /examples/i18n/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); -------------------------------------------------------------------------------- /examples/i18n/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "Hello World": "Hallo Welt" 3 | } -------------------------------------------------------------------------------- /examples/i18n/example.js: -------------------------------------------------------------------------------- 1 | console.log(__("Hello World")); 2 | console.log(__("Missing Text")); -------------------------------------------------------------------------------- /examples/labeled-modules/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/labeled-modules/example.js: -------------------------------------------------------------------------------- 1 | require: "./increment"; 2 | var a = 1; 3 | increment(a); // 2 -------------------------------------------------------------------------------- /examples/labeled-modules/increment.js: -------------------------------------------------------------------------------- 1 | require: "./math"; 2 | exports: function increment(val) { 3 | return add(val, 1); 4 | }; -------------------------------------------------------------------------------- /examples/labeled-modules/math.js: -------------------------------------------------------------------------------- 1 | exports: function add() { 2 | var sum = 0, i = 0, args = arguments, l = args.length; 3 | while (i < l) { 4 | sum += args[i++]; 5 | } 6 | return sum; 7 | }; -------------------------------------------------------------------------------- /examples/labeled-modules/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../"); 2 | module.exports = { 3 | plugins: [ 4 | new webpack.dependencies.LabeledModulesPlugin() 5 | ] 6 | } -------------------------------------------------------------------------------- /examples/loader/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/loader/enhanced-require.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | module: { 3 | loaders: [ 4 | { test: /\.json$/, loader: "json" } 5 | ] 6 | } 7 | } -------------------------------------------------------------------------------- /examples/loader/example.js: -------------------------------------------------------------------------------- 1 | // use our loader 2 | console.dir(require("./loader!./file")); 3 | 4 | // use buildin json loader 5 | console.dir(require("./test.json")); // default by extension 6 | console.dir(require("!json!./test.json")); // manual -------------------------------------------------------------------------------- /examples/loader/file.js: -------------------------------------------------------------------------------- 1 | exports.foo = "bar"; -------------------------------------------------------------------------------- /examples/loader/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(content) { 2 | return "exports.answer = 42;\n" + content; 3 | } -------------------------------------------------------------------------------- /examples/loader/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "foobar": 1234 3 | } -------------------------------------------------------------------------------- /examples/loader/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | module: { 3 | loaders: [ 4 | { test: /\.json$/, loader: "json" } 5 | ] 6 | } 7 | } -------------------------------------------------------------------------------- /examples/mixed/amd.js: -------------------------------------------------------------------------------- 1 | // AMD Module Format 2 | define( 3 | "app/amd", // anonym is also supported 4 | ["./commonjs", "./labeled"], 5 | function(commonjs1, labeled1) { 6 | // but you can use CommonJs-style requires: 7 | var commonjs2 = require("./commonjs"); 8 | var labeled2 = require("./labeled"); 9 | // Do something... 10 | return 456; 11 | } 12 | ); -------------------------------------------------------------------------------- /examples/mixed/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/mixed/commonjs.js: -------------------------------------------------------------------------------- 1 | // CommonJs Module Format 2 | module.exports = 123; 3 | 4 | // but you can use amd style requires 5 | require( 6 | ["./amd", "./labeled"], 7 | function(amd1, labeled1) { 8 | var amd2 = require("./amd"); 9 | var labeled2 = require("./labeled"); 10 | } 11 | ); -------------------------------------------------------------------------------- /examples/mixed/labeled.js: -------------------------------------------------------------------------------- 1 | // Labeled Module Format 2 | exports: var a = 123; 3 | 4 | // but you can use amd and commonjs style requires 5 | require( 6 | ["./commonjs", "./amd"], 7 | function(amd1) { 8 | var commonjs2 = require("./commonjs"); 9 | var amd2 = require("./amd"); 10 | } 11 | ); -------------------------------------------------------------------------------- /examples/mixed/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../"); 2 | module.exports = { 3 | plugins: [ 4 | new webpack.dependencies.LabeledModulesPlugin() 5 | ] 6 | } -------------------------------------------------------------------------------- /examples/move-to-parent/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /examples/move-to-parent/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /examples/move-to-parent/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | global.NO_REASONS = true; 3 | require("../build-common"); 4 | -------------------------------------------------------------------------------- /examples/move-to-parent/c.js: -------------------------------------------------------------------------------- 1 | module.exports = "c"; -------------------------------------------------------------------------------- /examples/move-to-parent/d.js: -------------------------------------------------------------------------------- 1 | module.exports = "d"; -------------------------------------------------------------------------------- /examples/move-to-parent/page.js: -------------------------------------------------------------------------------- 1 | require(["./a"]); 2 | require(["./a", "./b"]); 3 | require(["./a", "./b", "./c"]); 4 | require(["./a", "./b", "./c", "./d"]); 5 | -------------------------------------------------------------------------------- /examples/multi-compiler/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); -------------------------------------------------------------------------------- /examples/multi-compiler/example.js: -------------------------------------------------------------------------------- 1 | if(ENV === "mobile") { 2 | require("./mobile-stuff"); 3 | } 4 | console.log("Running " + ENV + " build"); -------------------------------------------------------------------------------- /examples/multi-compiler/mobile-stuff.js: -------------------------------------------------------------------------------- 1 | // mobile only stuff -------------------------------------------------------------------------------- /examples/multi-part-library/alpha.js: -------------------------------------------------------------------------------- 1 | module.exports = "alpha"; -------------------------------------------------------------------------------- /examples/multi-part-library/beta.js: -------------------------------------------------------------------------------- 1 | module.exports = "beta"; -------------------------------------------------------------------------------- /examples/multi-part-library/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); -------------------------------------------------------------------------------- /examples/multi-part-library/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | module.exports = { 3 | entry: { 4 | alpha: "./alpha", 5 | beta: "./beta" 6 | }, 7 | output: { 8 | path: path.join(__dirname, "js"), 9 | filename: "MyLibrary.[name].js", 10 | library: ["MyLibrary", "[name]"], 11 | libraryTarget: "umd" 12 | } 13 | } -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/adminPageA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/adminPageA.js: -------------------------------------------------------------------------------- 1 | require("./modules/a-b-c"); 2 | require("./modules/admin"); -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/adminPageB.js: -------------------------------------------------------------------------------- 1 | require("./modules/a-b-c"); 2 | require("./modules/admin"); -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/adminPageC.js: -------------------------------------------------------------------------------- 1 | require("./modules/a-b-c"); 2 | require("./modules/admin"); -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); 3 | -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/common.js: -------------------------------------------------------------------------------- 1 | module.exports = "Common"; -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/modules/a-b-c.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/multiple-commons-chunks/modules/a-b-c.js -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/modules/a-b.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/multiple-commons-chunks/modules/a-b.js -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/modules/a-c.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/multiple-commons-chunks/modules/a-c.js -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/modules/admin.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/multiple-commons-chunks/modules/admin.js -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/modules/b-c.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/multiple-commons-chunks/modules/b-c.js -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/pageA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/pageA.js: -------------------------------------------------------------------------------- 1 | require("./modules/a-b-c"); 2 | require("./modules/a-b"); 3 | require("./modules/a-c"); 4 | -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/pageB.js: -------------------------------------------------------------------------------- 1 | require("./modules/a-b-c"); 2 | require("./modules/a-b"); 3 | require("./modules/b-c"); 4 | -------------------------------------------------------------------------------- /examples/multiple-commons-chunks/pageC.js: -------------------------------------------------------------------------------- 1 | require("./modules/a-b-c"); 2 | require("./modules/b-c"); 3 | require("./modules/a-c"); 4 | -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/a.js: -------------------------------------------------------------------------------- 1 | require("./style.css"); 2 | require("./styleA.css"); 3 | -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/b.js: -------------------------------------------------------------------------------- 1 | require("./style.css"); 2 | require("./styleB.css"); 3 | -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/c.js: -------------------------------------------------------------------------------- 1 | require("./styleC.css"); 2 | -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/multiple-entry-points-commons-chunk-css-bundle/image.png -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/imageA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/multiple-entry-points-commons-chunk-css-bundle/imageA.png -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/imageB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/multiple-entry-points-commons-chunk-css-bundle/imageB.png -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/imageC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/examples/multiple-entry-points-commons-chunk-css-bundle/imageC.png -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: url(image.png); 3 | } 4 | -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/styleA.css: -------------------------------------------------------------------------------- 1 | .a { 2 | background: url(imageA.png); 3 | } 4 | -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/styleB.css: -------------------------------------------------------------------------------- 1 | .b { 2 | background: url(imageB.png); 3 | } 4 | -------------------------------------------------------------------------------- /examples/multiple-entry-points-commons-chunk-css-bundle/styleC.css: -------------------------------------------------------------------------------- 1 | @import "style.css"; 2 | .c { 3 | background: url(imageC.png); 4 | } 5 | -------------------------------------------------------------------------------- /examples/multiple-entry-points/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); 3 | -------------------------------------------------------------------------------- /examples/multiple-entry-points/common.js: -------------------------------------------------------------------------------- 1 | module.exports = "Common"; -------------------------------------------------------------------------------- /examples/multiple-entry-points/pageA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/multiple-entry-points/pageA.js: -------------------------------------------------------------------------------- 1 | var common = require("./common"); 2 | require(["./shared"], function(shared) { 3 | shared("This is page A"); 4 | }); -------------------------------------------------------------------------------- /examples/multiple-entry-points/pageAB.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/multiple-entry-points/pageB.js: -------------------------------------------------------------------------------- 1 | var common = require("./common"); 2 | require.ensure(["./shared"], function(require) { 3 | var shared = require("./shared"); 4 | shared("This is page B"); 5 | }); -------------------------------------------------------------------------------- /examples/multiple-entry-points/shared.js: -------------------------------------------------------------------------------- 1 | var common = require("./common"); 2 | module.exports = function(msg) { 3 | console.log(msg); 4 | }; -------------------------------------------------------------------------------- /examples/multiple-entry-points/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin"); 3 | module.exports = { 4 | entry: { 5 | pageA: "./pageA", 6 | pageB: "./pageB" 7 | }, 8 | output: { 9 | path: path.join(__dirname, "js"), 10 | filename: "[name].bundle.js", 11 | chunkFilename: "[id].chunk.js" 12 | }, 13 | plugins: [ 14 | new CommonsChunkPlugin("commons.js") 15 | ] 16 | } -------------------------------------------------------------------------------- /examples/named-chunks/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/named-chunks/node_modules/a.js: -------------------------------------------------------------------------------- 1 | // module a -------------------------------------------------------------------------------- /examples/named-chunks/node_modules/b.js: -------------------------------------------------------------------------------- 1 | // module b -------------------------------------------------------------------------------- /examples/named-chunks/node_modules/c.js: -------------------------------------------------------------------------------- 1 | // module c -------------------------------------------------------------------------------- /examples/named-chunks/node_modules/d.js: -------------------------------------------------------------------------------- 1 | // module d -------------------------------------------------------------------------------- /examples/node_modules/module.js: -------------------------------------------------------------------------------- 1 | module.exports = "module"; -------------------------------------------------------------------------------- /examples/require.context/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/require.context/example.js: -------------------------------------------------------------------------------- 1 | function getTemplate(templateName) { 2 | return require("./templates/"+templateName); 3 | } 4 | console.log(getTemplate("a")); 5 | console.log(getTemplate("b")); -------------------------------------------------------------------------------- /examples/require.context/templates/a.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return "This text was generated by template A"; 3 | } -------------------------------------------------------------------------------- /examples/require.context/templates/b.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return "This text was generated by template B"; 3 | } -------------------------------------------------------------------------------- /examples/require.context/templates/c.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return "This text was generated by template C"; 3 | } -------------------------------------------------------------------------------- /examples/require.resolve/a.js: -------------------------------------------------------------------------------- 1 | module.exports = Math.random(); -------------------------------------------------------------------------------- /examples/require.resolve/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/require.resolve/example.js: -------------------------------------------------------------------------------- 1 | var a = require("./a"); 2 | 3 | // get module id 4 | var aId = require.resolve("./a.js"); 5 | 6 | // clear module in require.cache 7 | delete require.cache[aId]; 8 | 9 | // require module again, it should be reexecuted 10 | var a2 = require("./a"); 11 | 12 | // vertify it 13 | if(a == a2) throw new Error("Cache clear failed :("); -------------------------------------------------------------------------------- /examples/require.resolve/template.md: -------------------------------------------------------------------------------- 1 | # example.js 2 | 3 | ``` javascript 4 | {{example.js}} 5 | ``` 6 | 7 | # a.js 8 | 9 | 10 | ``` javascript 11 | {{a.js}} 12 | ``` 13 | 14 | # js/output.js 15 | 16 | ``` javascript 17 | {{js/output.js}} 18 | ``` 19 | 20 | # Info 21 | 22 | ## Uncompressed 23 | 24 | ``` 25 | {{stdout}} 26 | ``` 27 | 28 | ## Minimized (uglify-js, no zip) 29 | 30 | ``` 31 | {{min:stdout}} 32 | ``` 33 | -------------------------------------------------------------------------------- /examples/two-explicit-vendor-chunks/build.js: -------------------------------------------------------------------------------- 1 | global.NO_TARGET_ARGS = true; 2 | require("../build-common"); 3 | -------------------------------------------------------------------------------- /examples/two-explicit-vendor-chunks/pageA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/two-explicit-vendor-chunks/pageA.js: -------------------------------------------------------------------------------- 1 | module.exports = "pageA"; 2 | require("./vendor1"); 3 | require("./vendor2"); 4 | -------------------------------------------------------------------------------- /examples/two-explicit-vendor-chunks/pageB.js: -------------------------------------------------------------------------------- 1 | module.exports = "pageB"; -------------------------------------------------------------------------------- /examples/two-explicit-vendor-chunks/pageC.js: -------------------------------------------------------------------------------- 1 | module.exports = "pageC"; -------------------------------------------------------------------------------- /examples/two-explicit-vendor-chunks/vendor1.js: -------------------------------------------------------------------------------- 1 | module.exports = "Vendor1"; -------------------------------------------------------------------------------- /examples/two-explicit-vendor-chunks/vendor2.js: -------------------------------------------------------------------------------- 1 | module.exports = "Vendor2"; 2 | require("./vendor1"); 3 | -------------------------------------------------------------------------------- /examples/web-worker/build.js: -------------------------------------------------------------------------------- 1 | require("../build-common"); -------------------------------------------------------------------------------- /examples/web-worker/example.js: -------------------------------------------------------------------------------- 1 | var Worker = require("worker!./worker"); 2 | var worker = new Worker; 3 | worker.postMessage("b"); 4 | worker.onmessage = function(event) { 5 | var templateB = event.data; // "This text was generated by template B" 6 | } -------------------------------------------------------------------------------- /examples/web-worker/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | worker: { 3 | output: { 4 | filename: "hash.worker.js", 5 | chunkFilename: "[id].hash.worker.js" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /examples/web-worker/worker.js: -------------------------------------------------------------------------------- 1 | onmessage = function(event) { 2 | var template = event.data; 3 | require(["../require.context/templates/" + event.data], function(tmpl) { 4 | postMessage(tmpl()); 5 | }); 6 | } 7 | -------------------------------------------------------------------------------- /hot/emitter.js: -------------------------------------------------------------------------------- 1 | var EventEmitter = require("events"); 2 | module.exports = new EventEmitter(); 3 | -------------------------------------------------------------------------------- /lib/MemoryOutputFileSystem.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Tobias Koppers @sokra 4 | */ 5 | module.exports = require("memory-fs"); 6 | -------------------------------------------------------------------------------- /lib/ModuleError.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Tobias Koppers @sokra 4 | */ 5 | function ModuleError(module, err) { 6 | Error.call(this); 7 | Error.captureStackTrace(this, ModuleError); 8 | this.name = "ModuleError"; 9 | this.module = module; 10 | this.message = err; 11 | this.error = err; 12 | } 13 | module.exports = ModuleError; 14 | 15 | ModuleError.prototype = Object.create(Error.prototype); 16 | -------------------------------------------------------------------------------- /lib/ModuleReason.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Tobias Koppers @sokra 4 | */ 5 | function ModuleReason(module, dependency) { 6 | this.module = module; 7 | this.dependency = dependency; 8 | } 9 | module.exports = ModuleReason; 10 | -------------------------------------------------------------------------------- /lib/NullFactory.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Tobias Koppers @sokra 4 | */ 5 | function NullFactory() {} 6 | module.exports = NullFactory; 7 | 8 | NullFactory.prototype.create = function(context, dependency, callback) { 9 | return callback(); 10 | }; 11 | -------------------------------------------------------------------------------- /lib/OptionsApply.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Tobias Koppers @sokra 4 | */ 5 | function OptionsApply() {} 6 | module.exports = OptionsApply; 7 | 8 | OptionsApply.prototype.process = function( /* options, compiler */ ) { 9 | 10 | }; 11 | -------------------------------------------------------------------------------- /lib/dependencies/NullDependencyTemplate.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Tobias Koppers @sokra 4 | */ 5 | function NullDependencyTemplate() {} 6 | module.exports = NullDependencyTemplate; 7 | 8 | NullDependencyTemplate.prototype.apply = function() {}; 9 | -------------------------------------------------------------------------------- /lib/node/NodeTargetPlugin.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Tobias Koppers @sokra 4 | */ 5 | var ExternalsPlugin = require("../ExternalsPlugin"); 6 | 7 | function NodeTargetPlugin() {} 8 | 9 | module.exports = NodeTargetPlugin; 10 | NodeTargetPlugin.prototype.apply = function(compiler) { 11 | new ExternalsPlugin("commonjs", Object.keys(process.binding("natives"))).apply(compiler); 12 | }; 13 | -------------------------------------------------------------------------------- /lib/removeAndDo.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License http://www.opensource.org/licenses/mit-license.php 3 | Author Tobias Koppers @sokra 4 | */ 5 | module.exports = function removeAndDo(collection, thing, action) { 6 | var idx = this[collection].indexOf(thing); 7 | if(idx >= 0) { 8 | this[collection].splice(idx, 1); 9 | thing[action](this); 10 | return true; 11 | } 12 | return false; 13 | }; 14 | -------------------------------------------------------------------------------- /test/Template.test.js: -------------------------------------------------------------------------------- 1 | ould = require("should"); 2 | var path = require("path"); 3 | 4 | var template = require("../lib/Template"); 5 | 6 | describe("Template", function() { 7 | it("should generate valid identifiers", function() { 8 | template.toIdentifier("0abc-def9").should.equal("_abc_def9"); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /test/browsertest/img/fail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/browsertest/img/fail.png -------------------------------------------------------------------------------- /test/browsertest/img/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/browsertest/img/image.png -------------------------------------------------------------------------------- /test/browsertest/lib/index.js: -------------------------------------------------------------------------------- 1 | require("./index.web.js"); 2 | 3 | describe("main", function() { 4 | it("should load index.web.js instead of index.js", function() { 5 | throw new Error("Fail"); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /test/browsertest/lib/stylesheet.css: -------------------------------------------------------------------------------- 1 | .style-test.css-styles { 2 | background: #3F3; 3 | } -------------------------------------------------------------------------------- /test/browsertest/lib/stylesheet.less: -------------------------------------------------------------------------------- 1 | .style-test.less-styles { 2 | background: #3F3; 3 | } -------------------------------------------------------------------------------- /test/browsertest/lib/testRequireMain.js: -------------------------------------------------------------------------------- 1 | module.exports = require.main === module; -------------------------------------------------------------------------------- /test/browsertest/lib/three.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; -------------------------------------------------------------------------------- /test/browsertest/lib/two.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; -------------------------------------------------------------------------------- /test/browsertest/node_modules/extra.loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(string) { 2 | this.cacheable(); 3 | return string + " with post loader"; 4 | } -------------------------------------------------------------------------------- /test/browsertest/node_modules/library1/lib/comp.js: -------------------------------------------------------------------------------- 1 | module.exports = "lib1 component"; -------------------------------------------------------------------------------- /test/browsertest/node_modules/library1/lib/component.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./comp.js"); -------------------------------------------------------------------------------- /test/browsertest/node_modules/library1/node_modules/submodule1/index.js: -------------------------------------------------------------------------------- 1 | module.exports = "submodule1"; -------------------------------------------------------------------------------- /test/browsertest/node_modules/library1/node_modules/submodule2/index.js: -------------------------------------------------------------------------------- 1 | module.exports = (function() { 2 | return "submodule2"; 3 | }()); -------------------------------------------------------------------------------- /test/browsertest/node_modules/library2/lib/common.js: -------------------------------------------------------------------------------- 1 | var should = require("should"); 2 | 3 | var typeofLibrary2 = typeof library2; 4 | 5 | describe("library2", function() { 6 | it("should run before main", function() { 7 | typeofLibrary2.should.be.eql("undefined"); 8 | }); 9 | }); 10 | exports.library2common = { ok2: true }; -------------------------------------------------------------------------------- /test/browsertest/node_modules/library2/lib/extra.js: -------------------------------------------------------------------------------- 1 | module.exports = "Lib2 extra"; -------------------------------------------------------------------------------- /test/browsertest/node_modules/library2/lib/extra2.js: -------------------------------------------------------------------------------- 1 | module.exports = "Lib2 extra2"; -------------------------------------------------------------------------------- /test/browsertest/node_modules/library2/lib/test.js: -------------------------------------------------------------------------------- 1 | module.exports = "test module"; -------------------------------------------------------------------------------- /test/browsertest/node_modules/library2/node_modules/submodule1/index.js: -------------------------------------------------------------------------------- 1 | module.exports = "submodule1"; -------------------------------------------------------------------------------- /test/browsertest/node_modules/library2/node_modules/submodule2/index.js: -------------------------------------------------------------------------------- 1 | module.exports = (function() { 2 | return "submodule2"; 3 | }()); -------------------------------------------------------------------------------- /test/browsertest/node_modules/library2/node_modules/submodule3/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return "submodule3"; 3 | }; -------------------------------------------------------------------------------- /test/browsertest/node_modules/library2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/main.js" 3 | } -------------------------------------------------------------------------------- /test/browsertest/node_modules/library2b.js: -------------------------------------------------------------------------------- 1 | describe("library2b", function() { 2 | it("should load this library", function() { 3 | true.should.be.ok; 4 | }); 5 | }); 6 | -------------------------------------------------------------------------------- /test/browsertest/node_modules/subcontent/index.js: -------------------------------------------------------------------------------- 1 | module.exports = "error"; -------------------------------------------------------------------------------- /test/browsertest/node_modules/subcontent/test.jade: -------------------------------------------------------------------------------- 1 | xyz: abc -------------------------------------------------------------------------------- /test/browsertest/node_modules/subcontent2/file.js: -------------------------------------------------------------------------------- 1 | module.exports = "orginal"; -------------------------------------------------------------------------------- /test/browsertest/node_modules/submodule3/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return "submodule3"; 3 | }; -------------------------------------------------------------------------------- /test/browsertest/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-webkit-tests", 3 | "main": "tests.html" 4 | } -------------------------------------------------------------------------------- /test/browsertest/web_modules/subcontent/index.js: -------------------------------------------------------------------------------- 1 | module.exports = "replaced"; -------------------------------------------------------------------------------- /test/cases/chunks/context/index.js: -------------------------------------------------------------------------------- 1 | it("should also work in a chunk", function(done) { 2 | require.ensure([], function(require) { 3 | var contextRequire = require.context(".", false, /two/); 4 | contextRequire("./two").should.be.eql(2); 5 | var tw = "tw"; 6 | require("." + "/" + tw + "o").should.be.eql(2); 7 | done(); 8 | }); 9 | }); 10 | 11 | -------------------------------------------------------------------------------- /test/cases/chunks/context/two.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; -------------------------------------------------------------------------------- /test/cases/chunks/import-context/dir/one.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /test/cases/chunks/import-context/dir/three.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /test/cases/chunks/import-context/dir/two.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /test/cases/chunks/import/index.js: -------------------------------------------------------------------------------- 1 | it("should be able to use System.import", function(done) { 2 | System.import("./two").then(function(two) { 3 | two.should.be.eql(2); 4 | done(); 5 | }).catch(function(err) { 6 | done(err); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /test/cases/chunks/import/two.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; -------------------------------------------------------------------------------- /test/cases/chunks/named-chunks/empty.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/chunks/named-chunks/empty.js -------------------------------------------------------------------------------- /test/cases/chunks/parsing/empty.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/chunks/parsing/empty.js -------------------------------------------------------------------------------- /test/cases/chunks/parsing/require.include.js: -------------------------------------------------------------------------------- 1 | module.exports = "require.include"; -------------------------------------------------------------------------------- /test/cases/chunks/runtime/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/cases/chunks/runtime/acircular.js: -------------------------------------------------------------------------------- 1 | require.ensure(["./acircular2"], function(require) { 2 | require("./acircular2"); 3 | }) -------------------------------------------------------------------------------- /test/cases/chunks/runtime/acircular2.js: -------------------------------------------------------------------------------- 1 | require.ensure(["./acircular"], function(require) { 2 | require("./acircular"); 3 | }) -------------------------------------------------------------------------------- /test/cases/chunks/runtime/b.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./a"); -------------------------------------------------------------------------------- /test/cases/chunks/runtime/duplicate.js: -------------------------------------------------------------------------------- 1 | require.ensure(["./a"], function(require) { 2 | require("./a").should.be.eql("a"); 3 | }) -------------------------------------------------------------------------------- /test/cases/chunks/runtime/duplicate2.js: -------------------------------------------------------------------------------- 1 | require.ensure(["./b"], function(require) { 2 | require("./b").should.be.eql("a"); 3 | }) -------------------------------------------------------------------------------- /test/cases/chunks/runtime/empty.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/chunks/runtime/empty.js -------------------------------------------------------------------------------- /test/cases/chunks/weak-dependencies/a.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/chunks/weak-dependencies/a.js -------------------------------------------------------------------------------- /test/cases/chunks/weak-dependencies/b.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/chunks/weak-dependencies/b.js -------------------------------------------------------------------------------- /test/cases/chunks/weak-dependencies/c.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/chunks/weak-dependencies/c.js -------------------------------------------------------------------------------- /test/cases/chunks/weak-dependencies/d.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/chunks/weak-dependencies/d.js -------------------------------------------------------------------------------- /test/cases/compile/deduplication-bundle-loader/a/file.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/cases/compile/deduplication-bundle-loader/b/file.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /test/cases/compile/deduplication-bundle-loader/index.js: -------------------------------------------------------------------------------- 1 | it("should load a duplicate module with different dependencies correctly", function(done) { 2 | var a = require("bundle!./a/file"); 3 | var b = require("bundle!./b/file"); 4 | (typeof a).should.be.eql("function"); 5 | (typeof b).should.be.eql("function"); 6 | a(function(ra) { 7 | ra.should.be.eql("a"); 8 | b(function(rb) { 9 | rb.should.be.eql("b"); 10 | done(); 11 | }) 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /test/cases/compile/deduplication/d.js: -------------------------------------------------------------------------------- 1 | module.exports = "d"; -------------------------------------------------------------------------------- /test/cases/compile/deduplication/dedupe1/dupdep.js: -------------------------------------------------------------------------------- 1 | module.exports = "edupe1"; -------------------------------------------------------------------------------- /test/cases/compile/deduplication/dedupe1/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("../d") + require("./dupdep"); 2 | var ep = "ep"; 3 | require("./dupd" + ep); 4 | -------------------------------------------------------------------------------- /test/cases/compile/deduplication/dedupe2/dupdep.js: -------------------------------------------------------------------------------- 1 | module.exports = "edupe2"; -------------------------------------------------------------------------------- /test/cases/compile/deduplication/dedupe2/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("../d") + require("./dupdep"); 2 | var ep = "ep"; 3 | require("./dupd" + ep); 4 | -------------------------------------------------------------------------------- /test/cases/compile/deduplication/index.js: -------------------------------------------------------------------------------- 1 | it("should load a duplicate module with different dependencies correctly", function() { 2 | var dedupe1 = require("./dedupe1"); 3 | var dedupe2 = require("./dedupe2"); 4 | dedupe1.should.be.eql("dedupe1"); 5 | dedupe2.should.be.eql("dedupe2"); 6 | }); 7 | -------------------------------------------------------------------------------- /test/cases/compile/error-hide-stack/errors.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Module build failed: Message\nStack/] 3 | ]; -------------------------------------------------------------------------------- /test/cases/compile/error-hide-stack/index.js: -------------------------------------------------------------------------------- 1 | it("should hide stack in details", function() { 2 | (function f() { 3 | require("./loader!"); 4 | }).should.throw(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/cases/compile/error-hide-stack/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | var err = new Error("Message"); 3 | err.stack = "Stack"; 4 | err.hideStack = true; 5 | throw err; 6 | }; -------------------------------------------------------------------------------- /test/cases/context/ignore-hidden-files/folder/.file.js: -------------------------------------------------------------------------------- 1 | module.exports = "fail"; -------------------------------------------------------------------------------- /test/cases/context/ignore-hidden-files/index.js: -------------------------------------------------------------------------------- 1 | it("should ignore hidden files", function() { 2 | (function() { 3 | var name = "./file.js"; 4 | require("./folder/" + name); 5 | }).should.throw(); 6 | }); -------------------------------------------------------------------------------- /test/cases/context/issue-1769/folder/0.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/context/issue-1769/folder/0.js -------------------------------------------------------------------------------- /test/cases/context/issue-1769/index.js: -------------------------------------------------------------------------------- 1 | it("should be able the catch a incorrect System.import", function(done) { 2 | var expr = "1"; 3 | System.import("./folder/" + expr).then(function() { 4 | done(new Error("should not be called")); 5 | }).catch(function(err) { 6 | err.should.be.instanceof(Error); 7 | done(); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /test/cases/loaders/_css/folder/stylesheet-import1.css: -------------------------------------------------------------------------------- 1 | @import url(~resources-module/stylesheet-import2.css) print, screen; 2 | @import url(stylesheet-import3.css) print and screen; 3 | 4 | .rule-import1 { 5 | background: lightgreen; 6 | } 7 | -------------------------------------------------------------------------------- /test/cases/loaders/_css/folder/stylesheet-import3.css: -------------------------------------------------------------------------------- 1 | .rule-import2 { 2 | background: red !important; 3 | } -------------------------------------------------------------------------------- /test/cases/loaders/_css/generateCss.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"); 2 | var path = require("path"); 3 | module.exports = fs.readFileSync(path.join(path.dirname(__filename), "stylesheet.css"), "utf-8") + "\n.generated { color: red; }"; 4 | -------------------------------------------------------------------------------- /test/cases/loaders/_css/node_modules/resources-module/import2.less: -------------------------------------------------------------------------------- 1 | .less-rule-import2 { 2 | background: lightgreen; 3 | } -------------------------------------------------------------------------------- /test/cases/loaders/_css/node_modules/resources-module/stylesheet-import2.css: -------------------------------------------------------------------------------- 1 | .rule-import2 { 2 | background: lightgreen; 3 | } -------------------------------------------------------------------------------- /test/cases/loaders/_css/stylesheet.css: -------------------------------------------------------------------------------- 1 | @import url(folder/stylesheet-import1.css); 2 | 3 | .rule-direct { 4 | background: lightgreen; 5 | } -------------------------------------------------------------------------------- /test/cases/loaders/_resources/abc.txt: -------------------------------------------------------------------------------- 1 | abc -------------------------------------------------------------------------------- /test/cases/loaders/_resources/included.jade: -------------------------------------------------------------------------------- 1 | h1 included -------------------------------------------------------------------------------- /test/cases/loaders/_resources/parent.jade: -------------------------------------------------------------------------------- 1 | p 2 | block content 3 | include included 4 | -------------------------------------------------------------------------------- /test/cases/loaders/_resources/script.coffee: -------------------------------------------------------------------------------- 1 | condition = true 2 | obj = 3 | text: "coffee test" 4 | 5 | module.exports = obj.text if condition? -------------------------------------------------------------------------------- /test/cases/loaders/_resources/template.jade: -------------------------------------------------------------------------------- 1 | extends parent 2 | 3 | block content 4 | = typeof abc === "undefined" ? "self" + self.abc : abc -------------------------------------------------------------------------------- /test/cases/loaders/async/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/cases/loaders/async/loaders/asyncloader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(content) { 2 | var cb = this.async(); 3 | if(!cb) throw new Error("Loader should allow async mode"); 4 | if(cb !== this.callback) throw new Error("result of this.async() should be equal to this.callback"); 5 | process.nextTick(function() { 6 | cb(null, content); 7 | }); 8 | }; -------------------------------------------------------------------------------- /test/cases/loaders/async/loaders/syncloader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(content) { 2 | return content; 3 | }; -------------------------------------------------------------------------------- /test/cases/loaders/coffee-loader/module-only.coffee: -------------------------------------------------------------------------------- 1 | module -------------------------------------------------------------------------------- /test/cases/loaders/coffee-loader/script.coffee.md: -------------------------------------------------------------------------------- 1 | # literate coffeescript test 2 | 3 | Set some `condition` to `true 4 | 5 | condition = true 6 | 7 | Create an object with some text 8 | 9 | obj = 10 | text: "literate coffee test" 11 | 12 | Export the text if the condition is true 13 | 14 | module.exports = obj.text if condition? -------------------------------------------------------------------------------- /test/cases/loaders/context/index.js: -------------------------------------------------------------------------------- 1 | it("should be able to use a context with a loader", function() { 2 | var abc = "abc", scr = "script.coffee"; 3 | require("../_resources/" + scr).should.be.eql("coffee test"); 4 | require("raw!../_resources/" + abc + ".txt").should.be.eql("abc"); 5 | }); 6 | -------------------------------------------------------------------------------- /test/cases/loaders/css-loader/index.js: -------------------------------------------------------------------------------- 1 | it("should handle the css loader correctly", function() { 2 | (require("!css!../_css/stylesheet.css") + "").indexOf(".rule-direct").should.not.be.eql(-1); 3 | (require("!css!../_css/stylesheet.css") + "").indexOf(".rule-import1").should.not.be.eql(-1); 4 | (require("!css!../_css/stylesheet.css") + "").indexOf(".rule-import2").should.not.be.eql(-1); 5 | }); 6 | -------------------------------------------------------------------------------- /test/cases/loaders/jade-loader/index.js: -------------------------------------------------------------------------------- 1 | it("should handle the jade loader correctly", function() { 2 | require("!jade?self!../_resources/template.jade")({abc: "abc"}).should.be.eql("

selfabc

included

"); 3 | require("../_resources/template.jade")({abc: "abc"}).should.be.eql("

abc

included

"); 4 | }); 5 | -------------------------------------------------------------------------------- /test/cases/loaders/json-loader/index.js: -------------------------------------------------------------------------------- 1 | it("should handle the json loader correctly", function() { 2 | require("!json!../../../../package.json").name.should.be.eql("webpack"); 3 | require("../../../../package.json").name.should.be.eql("webpack"); 4 | }); 5 | -------------------------------------------------------------------------------- /test/cases/loaders/less-loader/index.js: -------------------------------------------------------------------------------- 1 | it("should handle the less loader (piped with raw loader) correctly", function() { 2 | require("!raw!less!./less/stylesheet.less").indexOf(".less-rule-direct").should.not.be.eql(-1); 3 | require("!raw!less!./less/stylesheet.less").indexOf(".less-rule-import1").should.not.be.eql(-1); 4 | require("!raw!less!./less/stylesheet.less").indexOf(".less-rule-import2").should.not.be.eql(-1); 5 | }); 6 | -------------------------------------------------------------------------------- /test/cases/loaders/less-loader/less/folder/import1.less: -------------------------------------------------------------------------------- 1 | @import "~resources-module/import2.less"; 2 | 3 | .less-rule-import1 { 4 | background: lightgreen; 5 | background-image: url("url.js"); 6 | } 7 | -------------------------------------------------------------------------------- /test/cases/loaders/less-loader/less/folder/url.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/loaders/less-loader/less/folder/url.js -------------------------------------------------------------------------------- /test/cases/loaders/less-loader/less/stylesheet.less: -------------------------------------------------------------------------------- 1 | @import "folder/import1"; 2 | 3 | .less-rule-direct { 4 | background: lightgreen; 5 | } -------------------------------------------------------------------------------- /test/cases/loaders/less-loader/node_modules/resources-module/import2.less: -------------------------------------------------------------------------------- 1 | .less-rule-import2 { 2 | background: lightgreen; 3 | } -------------------------------------------------------------------------------- /test/cases/loaders/less-loader/node_modules/resources-module/stylesheet-import2.css: -------------------------------------------------------------------------------- 1 | .rule-import2 { 2 | background: lightgreen; 3 | } -------------------------------------------------------------------------------- /test/cases/loaders/module-description-file/node_modules/testloader/lib/loader-indirect.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./loader.webpack-loader.js"); -------------------------------------------------------------------------------- /test/cases/loaders/module-description-file/node_modules/testloader/lib/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(content) { 2 | var content = contents[0]; 3 | callback(null, "module.exports=" + JSON.stringify(content)); 4 | } 5 | -------------------------------------------------------------------------------- /test/cases/loaders/module-description-file/node_modules/testloader/lib/loader.webpack-loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(content) { 2 | return "module.exports=" + JSON.stringify(content+"webpack"); 3 | } 4 | -------------------------------------------------------------------------------- /test/cases/loaders/module-description-file/node_modules/testloader/lib/loader2.web-loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(content) { 2 | this.callback(null, "module.exports=" + JSON.stringify(content+"web")); 3 | } 4 | -------------------------------------------------------------------------------- /test/cases/loaders/module-description-file/node_modules/testloader/lib/loader3.loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(content) { 2 | var callback = this.async(); 3 | callback(null, "module.exports=" + JSON.stringify(content+"loader")); 4 | } 5 | -------------------------------------------------------------------------------- /test/cases/loaders/module-description-file/node_modules/testloader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "testloader", 3 | "webpackLoader": "lib/loader.webpack-loader.js" 4 | } -------------------------------------------------------------------------------- /test/cases/loaders/module-description-file/reverseloader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(content) { 2 | return content.split("").reverse().join(""); 3 | } 4 | -------------------------------------------------------------------------------- /test/cases/loaders/query/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/cases/loaders/query/context-query-test/test.js: -------------------------------------------------------------------------------- 1 | test content -------------------------------------------------------------------------------- /test/cases/loaders/query/loaders/queryloader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(content) { 2 | return "module.exports = " + JSON.stringify({ 3 | resourceQuery: this.resourceQuery, 4 | query: this.query, 5 | prev: content 6 | }); 7 | } 8 | -------------------------------------------------------------------------------- /test/cases/loaders/raw-loader/index.js: -------------------------------------------------------------------------------- 1 | it("should handle the raw loader correctly", function() { 2 | require("raw!../_resources/abc.txt").should.be.eql("abc"); 3 | }); 4 | -------------------------------------------------------------------------------- /test/cases/loaders/val-loader/index.js: -------------------------------------------------------------------------------- 1 | it("should handle the val loader (piped with css loader) correctly", function() { 2 | (require("!css!val!../_css/generateCss") + "").indexOf("generated").should.not.be.eql(-1); 3 | (require("!css!val!../_css/generateCss") + "").indexOf(".rule-import2").should.not.be.eql(-1); 4 | (require("!raw!val!../_css/generateCss") + "").indexOf("generated").should.not.be.eql(-1); 5 | }); 6 | -------------------------------------------------------------------------------- /test/cases/parsing/bom/bomfile.css: -------------------------------------------------------------------------------- 1 | body{color:#abc} -------------------------------------------------------------------------------- /test/cases/parsing/bom/bomfile.js: -------------------------------------------------------------------------------- 1 | module.exports = "ok"; -------------------------------------------------------------------------------- /test/cases/parsing/bom/index.js: -------------------------------------------------------------------------------- 1 | it("should load a utf-8 file with BOM", function() { 2 | var result = require("./bomfile"); 3 | result.should.be.eql("ok"); 4 | }); 5 | 6 | it("should load a css file with BOM", function() { 7 | var css = require("!css-loader!./bomfile.css") + ""; 8 | css.should.be.eql("body{color:#abc}"); 9 | }); 10 | -------------------------------------------------------------------------------- /test/cases/parsing/bom/typeof.js: -------------------------------------------------------------------------------- 1 | module.exports = typeof require; -------------------------------------------------------------------------------- /test/cases/parsing/browserify/warnings.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/pre-built/], 3 | [/pre-built/] 4 | ]; -------------------------------------------------------------------------------- /test/cases/parsing/chunks/file.js: -------------------------------------------------------------------------------- 1 | module.exports = "ok"; -------------------------------------------------------------------------------- /test/cases/parsing/context/templates/dump-file.txt: -------------------------------------------------------------------------------- 1 | This is a file! 2 | 3 | with some content 4 | 5 | it should break webpack :) -------------------------------------------------------------------------------- /test/cases/parsing/context/templates/node_modules/xyz.js: -------------------------------------------------------------------------------- 1 | module.exports = "xyz"; -------------------------------------------------------------------------------- /test/cases/parsing/context/templates/subdir/tmpl.js: -------------------------------------------------------------------------------- 1 | module.exports = "subdir test template"; -------------------------------------------------------------------------------- /test/cases/parsing/context/templates/templateLoader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(name) { 2 | return require(name); 3 | } -------------------------------------------------------------------------------- /test/cases/parsing/context/templates/templateLoaderIndirect.js: -------------------------------------------------------------------------------- 1 | module.exports = function(name) { 2 | var a = load(require, name); 3 | var r = require; 4 | var b = r(name); 5 | if(a !== b) return "FAIL"; 6 | return a; 7 | } 8 | 9 | function load(requireFunction, name) { 10 | return requireFunction(name); 11 | } -------------------------------------------------------------------------------- /test/cases/parsing/context/templates/tmpl.js: -------------------------------------------------------------------------------- 1 | module.exports = "test template"; -------------------------------------------------------------------------------- /test/cases/parsing/context/warnings.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Module parse failed/, /dump-file\.txt/, /templates \^\\\.\\\/\.\*\$/], 3 | [/Critical dependencies/, /templateLoader\.js/], 4 | [/Critical dependencies/, /templateLoaderIndirect\.js/], 5 | ]; -------------------------------------------------------------------------------- /test/cases/parsing/es6.nominimize/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; 2 | -------------------------------------------------------------------------------- /test/cases/parsing/es6.nominimize/array.js: -------------------------------------------------------------------------------- 1 | module.exports = [1, 2, 3]; 2 | -------------------------------------------------------------------------------- /test/cases/parsing/es6.nominimize/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; 2 | -------------------------------------------------------------------------------- /test/cases/parsing/es6.nominimize/c.js: -------------------------------------------------------------------------------- 1 | module.exports = "c"; 2 | -------------------------------------------------------------------------------- /test/cases/parsing/es6.nominimize/object.js: -------------------------------------------------------------------------------- 1 | module.exports = {a: 1, b: 2, c: 3}; 2 | -------------------------------------------------------------------------------- /test/cases/parsing/evaluate/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/cases/parsing/evaluate/resourceQuery/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require((__resourceQuery.substr(1) + "/resourceQuery/returnRQ?XXXQuery").replace(/XXX/g, "resource")); -------------------------------------------------------------------------------- /test/cases/parsing/evaluate/resourceQuery/returnRQ.js: -------------------------------------------------------------------------------- 1 | module.exports = __resourceQuery; -------------------------------------------------------------------------------- /test/cases/parsing/extract-amd/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/cases/parsing/extract-amd/c.js: -------------------------------------------------------------------------------- 1 | module.exports = "c"; -------------------------------------------------------------------------------- /test/cases/parsing/extract-amd/circular.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | module.exports = require("./circular"); -------------------------------------------------------------------------------- /test/cases/parsing/extract-amd/constructor.js: -------------------------------------------------------------------------------- 1 | module.exports = function(value) { 2 | this.value = value; 3 | } -------------------------------------------------------------------------------- /test/cases/parsing/extract-amd/d.js: -------------------------------------------------------------------------------- 1 | module.exports = "d"; -------------------------------------------------------------------------------- /test/cases/parsing/extract-amd/optional.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | try { module.exports.a = require("./a"); } catch (e) {}; 3 | try { module.exports.b = require("./b"); } catch (e) {}; 4 | -------------------------------------------------------------------------------- /test/cases/parsing/extract-amd/templates/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/cases/parsing/extract-amd/templates/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /test/cases/parsing/extract-amd/templates/c.js: -------------------------------------------------------------------------------- 1 | module.exports = "c"; -------------------------------------------------------------------------------- /test/cases/parsing/extract-amd/warnings.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Module not found/, /Can't resolve '\.\/b' /, /b\.js/] 3 | ]; 4 | -------------------------------------------------------------------------------- /test/cases/parsing/extract-labeled/index.js: -------------------------------------------------------------------------------- 1 | it("should parse and evaluate labeled modules", function() { 2 | var lbm = require("./labeledModuleA"); 3 | lbm.should.have.property("x").be.eql("x"); 4 | lbm.should.have.property("y").have.type("function"); 5 | lbm.y().should.be.eql("y"); 6 | lbm.should.have.property("z").be.eql("z"); 7 | lbm.should.have.property("foo").have.type("function"); 8 | lbm.foo().should.be.eql("foo"); 9 | }); 10 | -------------------------------------------------------------------------------- /test/cases/parsing/extract-labeled/labeledModuleA.js: -------------------------------------------------------------------------------- 1 | require: "./labeledModuleB"; 2 | 3 | exports: x, y, z; 4 | 5 | exports: function foo(){ return "foo"; }; 6 | -------------------------------------------------------------------------------- /test/cases/parsing/extract-labeled/labeledModuleB.js: -------------------------------------------------------------------------------- 1 | exports: var x = "x", y = function() { return "y"; }; 2 | 3 | var z = "z"; 4 | exports: z; -------------------------------------------------------------------------------- /test/cases/parsing/extract-require/constructor.js: -------------------------------------------------------------------------------- 1 | module.exports = function(value) { 2 | this.value = value; 3 | } -------------------------------------------------------------------------------- /test/cases/parsing/extract-require/errors.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Module not found/, /Can't resolve '\.\/missingModule' /, /extract-require\/index.js/] 3 | ]; -------------------------------------------------------------------------------- /test/cases/parsing/extract-require/folder/file1.js: -------------------------------------------------------------------------------- 1 | module.exports = "file1"; -------------------------------------------------------------------------------- /test/cases/parsing/extract-require/folder/file2.js: -------------------------------------------------------------------------------- 1 | module.exports = "file2"; -------------------------------------------------------------------------------- /test/cases/parsing/extract-require/folder/file3.js: -------------------------------------------------------------------------------- 1 | module.exports = "file3"; -------------------------------------------------------------------------------- /test/cases/parsing/filename/index.js: -------------------------------------------------------------------------------- 1 | it("should be a string (__filename)", function() { 2 | __filename.should.be.type("string"); 3 | var f = __filename; 4 | f.should.be.type("string"); 5 | }); 6 | 7 | it("should be a string (__dirname)", function() { 8 | __dirname.should.be.type("string"); 9 | var d = __dirname; 10 | d.should.be.type("string"); 11 | }); -------------------------------------------------------------------------------- /test/cases/parsing/harmony-export-precedence/a.js: -------------------------------------------------------------------------------- 1 | export function a() { return "a1"; } 2 | export { a, b } from "./b"; 3 | export * from "./c"; 4 | export { d, e } from "./b"; 5 | export var e = "e1"; 6 | -------------------------------------------------------------------------------- /test/cases/parsing/harmony-export-precedence/b.js: -------------------------------------------------------------------------------- 1 | export var a = "a2"; 2 | export var b = "b2"; 3 | export var c = "c2"; 4 | export var d = "d2"; 5 | export var e = "e2"; 6 | -------------------------------------------------------------------------------- /test/cases/parsing/harmony-export-precedence/c.js: -------------------------------------------------------------------------------- 1 | export var a = "a3"; 2 | export var b = "b3"; 3 | export var c = "c3"; 4 | export var e = "e3"; 5 | export var f = "f3"; 6 | export default "default"; 7 | -------------------------------------------------------------------------------- /test/cases/parsing/harmony-export-precedence/d.js: -------------------------------------------------------------------------------- 1 | export default "default"; 2 | -------------------------------------------------------------------------------- /test/cases/parsing/harmony/node_modules/abc.js: -------------------------------------------------------------------------------- 1 | export var a = "a"; 2 | export var b = "b"; 3 | export {c} from "./abc_c"; -------------------------------------------------------------------------------- /test/cases/parsing/harmony/node_modules/abc_c.js: -------------------------------------------------------------------------------- 1 | export var c = "c"; 2 | -------------------------------------------------------------------------------- /test/cases/parsing/harmony/node_modules/circularEven.js: -------------------------------------------------------------------------------- 1 | import { odd } from "circularOdd"; 2 | 3 | export default odd(3); 4 | 5 | export function even(n) { 6 | if(n == 0) return true; 7 | return odd(n - 1); 8 | } 9 | -------------------------------------------------------------------------------- /test/cases/parsing/harmony/node_modules/circularOdd.js: -------------------------------------------------------------------------------- 1 | import { even } from "circularEven"; 2 | 3 | export function odd(n) { 4 | if(n == 0) return false; 5 | return even(n - 1); 6 | } 7 | -------------------------------------------------------------------------------- /test/cases/parsing/harmony/node_modules/commonjs-trans.js: -------------------------------------------------------------------------------- 1 | exports.__esModule = true; 2 | 3 | exports.default = function Thing() { 4 | this.value = "thing"; 5 | }; 6 | 7 | exports.Other = "other"; 8 | -------------------------------------------------------------------------------- /test/cases/parsing/harmony/node_modules/commonjs.js: -------------------------------------------------------------------------------- 1 | module.exports = function Thing() { 2 | return "thing"; 3 | } 4 | 5 | module.exports.Other = "other"; -------------------------------------------------------------------------------- /test/cases/parsing/harmony/node_modules/def.js: -------------------------------------------------------------------------------- 1 | export default "def"; -------------------------------------------------------------------------------- /test/cases/parsing/harmony/node_modules/exportKinds.js: -------------------------------------------------------------------------------- 1 | export function fn() { 2 | return "fn"; 3 | } 4 | export var one = "one", two = "two"; 5 | 6 | export var test1 = fn(); 7 | export var test2 = two; 8 | -------------------------------------------------------------------------------- /test/cases/parsing/harmony/node_modules/exports-specifier.js: -------------------------------------------------------------------------------- 1 | var specA = 1, b = 2; 2 | export { specA, b as specB } 3 | -------------------------------------------------------------------------------- /test/cases/parsing/harmony/node_modules/reexport.js: -------------------------------------------------------------------------------- 1 | export * from "abc"; 2 | export { one as o, two } from "exportKinds"; -------------------------------------------------------------------------------- /test/cases/parsing/hot-api/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/cases/parsing/hot-api/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /test/cases/parsing/hot-api/index.js: -------------------------------------------------------------------------------- 1 | if(module.hot) { 2 | it("should run module.hot.accept(...)", function() { 3 | module.hot.accept("./a", function() {}); 4 | }); 5 | it("should run module.hot.accept()", function() { 6 | module.hot.accept(); 7 | }); 8 | it("should run module.hot.decline", function() { 9 | module.hot.decline("./b"); 10 | }); 11 | } else { 12 | it("should run module.hot.* (disabled)", function() { 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /test/cases/parsing/hot-error-handler/index.js: -------------------------------------------------------------------------------- 1 | it("should parse a self accept with error handler", function() { 2 | if(module.hot) { 3 | module.hot.accept(function(err) { 4 | 5 | }); 6 | } 7 | }); -------------------------------------------------------------------------------- /test/cases/parsing/hot-hash/index.js: -------------------------------------------------------------------------------- 1 | if(module.hot) { 2 | it("should have __webpack_hash__", function() { 3 | (typeof __webpack_hash__).should.be.type("string"); 4 | __webpack_hash__.should.match(/^[0-9a-f]{20}$/); 5 | }); 6 | } else { 7 | it("should have __webpack_hash__ (disabled)", function() { 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /test/cases/parsing/inject-free-vars/fail.js: -------------------------------------------------------------------------------- 1 | throw new Error("Fail"); -------------------------------------------------------------------------------- /test/cases/parsing/inject-free-vars/x1.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/parsing/inject-free-vars/x1.js -------------------------------------------------------------------------------- /test/cases/parsing/issue-1044/index.js: -------------------------------------------------------------------------------- 1 | it("should not crash on missing spaces", function() { 2 | (function() { 3 | return"function"==typeof define&&define.amd?"hello":"world"; 4 | })(); 5 | }); 6 | -------------------------------------------------------------------------------- /test/cases/parsing/issue-1600/file.js: -------------------------------------------------------------------------------- 1 | // module.js 2 | export default(function () { 3 | return 1; 4 | }); 5 | -------------------------------------------------------------------------------- /test/cases/parsing/issue-1600/index.js: -------------------------------------------------------------------------------- 1 | import fn from './file'; 2 | 3 | it("should compile correctly", function() { 4 | fn().should.be.eql(1); 5 | }); 6 | -------------------------------------------------------------------------------- /test/cases/parsing/issue-345/abc/abcTest.js: -------------------------------------------------------------------------------- 1 | module.exports = "ok"; -------------------------------------------------------------------------------- /test/cases/parsing/issue-345/index.js: -------------------------------------------------------------------------------- 1 | it("should parse multiple expressions in a require", function(done) { 2 | var name = "abc"; 3 | require(["./" + name + "/" + name + "Test"], function(x) { 4 | x.should.be.eql("ok"); 5 | done(); 6 | }); 7 | }); -------------------------------------------------------------------------------- /test/cases/parsing/issue-387/file.js: -------------------------------------------------------------------------------- 1 | module.exports = 4321; -------------------------------------------------------------------------------- /test/cases/parsing/issue-494/index.js: -------------------------------------------------------------------------------- 1 | it("should replace a free var in a IIFE", function() { 2 | (function(md) { 3 | md.should.be.type("function"); 4 | }(module.deprecate)); 5 | }); -------------------------------------------------------------------------------- /test/cases/parsing/issue-627/dir/test.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var expr1 = "a", expr2 = "b"; 3 | require(Math.random() < 0.5 ? expr1 : expr2); 4 | }).should.throw(); 5 | -------------------------------------------------------------------------------- /test/cases/parsing/issue-627/index.js: -------------------------------------------------------------------------------- 1 | it("should compile expr in ?: operator", function() { 2 | require("./dir/test"); 3 | }); 4 | -------------------------------------------------------------------------------- /test/cases/parsing/issue-627/warnings.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Critical dependencies/] 3 | ]; 4 | -------------------------------------------------------------------------------- /test/cases/parsing/javascript/index.js: -------------------------------------------------------------------------------- 1 | it("should parse sparse arrays", function() { // issue #136 2 | [,null].should.have.length(2); 3 | [0,,,0].should.have.length(4); 4 | }); 5 | -------------------------------------------------------------------------------- /test/cases/parsing/local-modules/dep.js: -------------------------------------------------------------------------------- 1 | module.exports = "dep"; -------------------------------------------------------------------------------- /test/cases/parsing/renaming/file.js: -------------------------------------------------------------------------------- 1 | module.exports = "ok"; -------------------------------------------------------------------------------- /test/cases/parsing/requirejs/index.js: -------------------------------------------------------------------------------- 1 | it("should ignore require.config", function() { 2 | require.config({ 3 | 4 | }); 5 | requirejs.config({ 6 | 7 | }); 8 | }); 9 | it("should have a require.version", function() { 10 | require.version.should.be.type("string"); 11 | }); 12 | -------------------------------------------------------------------------------- /test/cases/parsing/typeof/errorfile.js: -------------------------------------------------------------------------------- 1 | ))) This results in a syntax error loading this file. -------------------------------------------------------------------------------- /test/cases/parsing/typeof/typeof.js: -------------------------------------------------------------------------------- 1 | module.exports = typeof require; -------------------------------------------------------------------------------- /test/cases/parsing/var-hiding/index.js: -------------------------------------------------------------------------------- 1 | var fn = function(module) { 2 | if (typeof module !== 'number') { 3 | throw new Error("module should be a number"); 4 | } 5 | (typeof module).should.be.eql("number"); 6 | }; 7 | 8 | it("should hide a free var by function argument", function() { 9 | fn(1); 10 | }); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/errors.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Module not found/, /recursive-file\/a/, /Recursion in resolving/], 3 | [/Module not found/, /recursive-file\/b/, /Recursion in resolving/], 4 | [/Module not found/, /recursive-file\/c/, /Recursion in resolving/], 5 | [/Module not found/, /recursive-file\/d/, /Recursion in resolving/] 6 | ]; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/ignoring-module/file.js: -------------------------------------------------------------------------------- 1 | throw new Error("Fail"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/ignoring-module/index.js: -------------------------------------------------------------------------------- 1 | exports.module = require("wrong-module"); 2 | exports.file = require("./file"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/ignoring-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "wrong-module": false, 4 | "./file.js": false 5 | } 6 | } -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/new-module/index.js: -------------------------------------------------------------------------------- 1 | module.exports = "new-module"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/new-module/inner.js: -------------------------------------------------------------------------------- 1 | module.exports = "new-module/inner"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/recursive-file/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/recursive-file/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/recursive-file/c.js: -------------------------------------------------------------------------------- 1 | module.exports = "c"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/recursive-file/d.js: -------------------------------------------------------------------------------- 1 | module.exports = "d"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/recursive-file/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "a.js": "./a", 4 | "./b.js": "./b", 5 | "c.js": "./d.js", 6 | "./d.js": "./c.js" 7 | } 8 | } -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/recursive-module/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("new-module"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/recursive-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "new-module": "new-module" 4 | } 5 | } -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file1/file.js: -------------------------------------------------------------------------------- 1 | module.exports = "file"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file1/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./file"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file1/new-file.js: -------------------------------------------------------------------------------- 1 | module.exports = "new-file"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "./file.js": "./new-file.js" 4 | } 5 | } -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file2/file.js: -------------------------------------------------------------------------------- 1 | module.exports = "file"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file2/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./file"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "./file.js": "new-module" 4 | } 5 | } -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file3/file.js: -------------------------------------------------------------------------------- 1 | module.exports = "file"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file3/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./file"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "./file.js": "new-module/inner" 4 | } 5 | } -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file4/dir/file.js: -------------------------------------------------------------------------------- 1 | module.exports = "file"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file4/dir/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./file"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file4/dir/new-file.js: -------------------------------------------------------------------------------- 1 | module.exports = "new-file"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file4/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./dir"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-file4/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "./dir/file.js": "./dir/new-file" 4 | } 5 | } -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-module1/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("wrong-module"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-module1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "wrong-module": "new-module" 4 | } 5 | } -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-module2/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("wrong-module"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-module2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "wrong-module": "new-module/inner" 4 | } 5 | } -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-module3/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("new-module"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-module3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "new-module": "new-module/inner" 4 | } 5 | } -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-module4/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("wrong-module"); -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-module4/module.js: -------------------------------------------------------------------------------- 1 | module.exports = "replacing-module4/module"; -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/replacing-module4/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "wrong-module": "./module.js" 4 | } 5 | } -------------------------------------------------------------------------------- /test/cases/resolving/browser-field/node_modules/wrong-module.js: -------------------------------------------------------------------------------- 1 | module.exports = "wrong-module"; -------------------------------------------------------------------------------- /test/cases/resolving/context/loaders/queryloader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(content) { 2 | return "module.exports = " + JSON.stringify({ 3 | resourceQuery: this.resourceQuery, 4 | query: this.query, 5 | prev: content 6 | }); 7 | } 8 | -------------------------------------------------------------------------------- /test/cases/resolving/context/node_modules/subcontent/index.js: -------------------------------------------------------------------------------- 1 | module.exports = "error"; -------------------------------------------------------------------------------- /test/cases/resolving/context/node_modules/subcontent/test.jade: -------------------------------------------------------------------------------- 1 | xyz: abc -------------------------------------------------------------------------------- /test/cases/resolving/query/empty.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/resolving/query/empty.js -------------------------------------------------------------------------------- /test/cases/resolving/single-file-module/index.js: -------------------------------------------------------------------------------- 1 | it("should load single file modules", function() { 2 | require("subfilemodule").should.be.eql("subfilemodule"); 3 | }); 4 | -------------------------------------------------------------------------------- /test/cases/resolving/single-file-module/node_modules/subfilemodule.js: -------------------------------------------------------------------------------- 1 | module.exports = "subfilemodule"; -------------------------------------------------------------------------------- /test/cases/runtime/chunk-callback-order/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/cases/runtime/chunk-callback-order/b.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./a"); -------------------------------------------------------------------------------- /test/cases/runtime/chunk-callback-order/duplicate.js: -------------------------------------------------------------------------------- 1 | require.ensure(["./a"], function(require) { 2 | require("./a").should.be.eql("a"); 3 | }) -------------------------------------------------------------------------------- /test/cases/runtime/chunk-callback-order/duplicate2.js: -------------------------------------------------------------------------------- 1 | require.ensure(["./b"], function(require) { 2 | require("./b").should.be.eql("a"); 3 | }) -------------------------------------------------------------------------------- /test/cases/runtime/circular-dependencies/circular.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | module.exports = require("./circular"); -------------------------------------------------------------------------------- /test/cases/runtime/circular-dependencies/circular2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | module.exports = require("./circular2"); -------------------------------------------------------------------------------- /test/cases/runtime/circular-dependencies/index.js: -------------------------------------------------------------------------------- 1 | it("should load circular dependencies correctly", function() { 2 | require("./circular").should.be.eql(1); 3 | }); 4 | -------------------------------------------------------------------------------- /test/cases/runtime/error-handling/errors.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Module not found/, /Can't resolve '\.\/missingModule' /, /error-handling\/index.js/] 3 | ]; -------------------------------------------------------------------------------- /test/cases/runtime/error-handling/folder/file1.js: -------------------------------------------------------------------------------- 1 | module.exports = "file1"; -------------------------------------------------------------------------------- /test/cases/runtime/error-handling/folder/file2.js: -------------------------------------------------------------------------------- 1 | module.exports = "file2"; -------------------------------------------------------------------------------- /test/cases/runtime/error-handling/folder/file3.js: -------------------------------------------------------------------------------- 1 | module.exports = "file3"; -------------------------------------------------------------------------------- /test/cases/runtime/error-handling/warnings.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Module not found/, /Can't resolve '\.\/missingModule2' /, /error-handling\/index.js/] 3 | ]; -------------------------------------------------------------------------------- /test/cases/runtime/issue-1788/a.js: -------------------------------------------------------------------------------- 1 | import b from './b'; 2 | export default 'a-default'; 3 | export { btest } from "./b"; 4 | 5 | export function atest() { 6 | b.should.be.eql("b-default"); 7 | } 8 | -------------------------------------------------------------------------------- /test/cases/runtime/issue-1788/b.js: -------------------------------------------------------------------------------- 1 | import a from './a'; 2 | export default 'b-default'; 3 | 4 | export function btest() { 5 | a.should.be.eql("a-default"); 6 | } 7 | -------------------------------------------------------------------------------- /test/cases/runtime/issue-1788/index.js: -------------------------------------------------------------------------------- 1 | import { atest, btest } from "./a"; 2 | 3 | it("should have the correct values", function() { 4 | atest(); 5 | btest(); 6 | }); 7 | -------------------------------------------------------------------------------- /test/cases/runtime/missing-module-exception/index.js: -------------------------------------------------------------------------------- 1 | it("should have correct error code", function() { 2 | try { 3 | require("./fail"); 4 | } catch(e) { 5 | e.code.should.be.eql("MODULE_NOT_FOUND"); 6 | } 7 | }); -------------------------------------------------------------------------------- /test/cases/runtime/missing-module-exception/warnings.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Module not found/, /Can't resolve '\.\/fail' /] 3 | ]; -------------------------------------------------------------------------------- /test/cases/runtime/module-caching/singluar.js: -------------------------------------------------------------------------------- 1 | module.exports.value = 1; -------------------------------------------------------------------------------- /test/cases/runtime/module-caching/singluar2.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/cases/runtime/module-caching/singluar2.js -------------------------------------------------------------------------------- /test/cases/runtime/module-caching/two.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; -------------------------------------------------------------------------------- /test/cases/runtime/require-function/fail.js: -------------------------------------------------------------------------------- 1 | This file should not load! 2 | }][{ -------------------------------------------------------------------------------- /test/cases/runtime/require-function/index.js: -------------------------------------------------------------------------------- 1 | it("should have correct properties on the require function", function() { 2 | __webpack_require__.c.should.have.type("object"); 3 | __webpack_require__.m.should.have.type("object"); 4 | __webpack_require__.p.should.have.type("string"); 5 | }); -------------------------------------------------------------------------------- /test/configCases/additional-pass/simple/index.js: -------------------------------------------------------------------------------- 1 | it("should compile", function(done) { 2 | done(); 3 | }); 4 | -------------------------------------------------------------------------------- /test/configCases/additional-pass/simple/webpack.config.js: -------------------------------------------------------------------------------- 1 | var testPlugin = function() { 2 | var counter = 1; 3 | this.plugin("compilation", function(compilation) { 4 | var nr = counter++; 5 | compilation.plugin("need-additional-pass", function() { 6 | if(nr < 5) 7 | return true; 8 | }); 9 | }); 10 | }; 11 | 12 | module.exports = { 13 | plugins: [ 14 | testPlugin 15 | ] 16 | }; 17 | -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/duplicate/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/duplicate/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/duplicate/c.js: -------------------------------------------------------------------------------- 1 | module.exports = "c"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/duplicate/d.js: -------------------------------------------------------------------------------- 1 | module.exports = "d"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/duplicate/e.js: -------------------------------------------------------------------------------- 1 | module.exports = "e"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/duplicate/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../../../"); 2 | 3 | module.exports = { 4 | plugins: [ 5 | new webpack.optimize.CommonsChunkPlugin({ 6 | async: true 7 | }) 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/nested/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/nested/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/nested/c.js: -------------------------------------------------------------------------------- 1 | module.exports = "c"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/nested/d.js: -------------------------------------------------------------------------------- 1 | module.exports = "d"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/nested/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../../../"); 2 | 3 | module.exports = { 4 | plugins: [ 5 | new webpack.optimize.CommonsChunkPlugin({ 6 | async: true 7 | }) 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/simple/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/simple/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "b"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/simple/c.js: -------------------------------------------------------------------------------- 1 | module.exports = "c"; -------------------------------------------------------------------------------- /test/configCases/async-commons-chunk/simple/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../../../"); 2 | 3 | module.exports = { 4 | plugins: [ 5 | new webpack.optimize.CommonsChunkPlugin({ 6 | name: "main", 7 | async: true 8 | }) 9 | ] 10 | }; 11 | -------------------------------------------------------------------------------- /test/configCases/context-replacement/a/index.js: -------------------------------------------------------------------------------- 1 | it("should replace a context with a new resource and reqExp", function(done) { 2 | function rqInContext(x, callback) { 3 | require([x], function(x) { 4 | callback(x); 5 | }); 6 | } 7 | rqInContext("replaced", function(r) { 8 | r.should.be.eql("ok"); 9 | done(); 10 | }); 11 | }); -------------------------------------------------------------------------------- /test/configCases/context-replacement/a/new-context/node_modules/error.js: -------------------------------------------------------------------------------- 1 | This 2 | should 3 | result 4 | in 5 | an 6 | error 7 | }]) -------------------------------------------------------------------------------- /test/configCases/context-replacement/a/new-context/node_modules/replaced.js: -------------------------------------------------------------------------------- 1 | module.exports = "ok"; -------------------------------------------------------------------------------- /test/configCases/context-replacement/a/warnings.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Critical dependencies/, /a\/index\.js/] 3 | ]; -------------------------------------------------------------------------------- /test/configCases/context-replacement/a/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | var webpack = require("../../../../"); 3 | 4 | module.exports = { 5 | plugins: [ 6 | new webpack.ContextReplacementPlugin(/context-replacement.a$/, "new-context", true, /^replaced$/) 7 | ] 8 | }; -------------------------------------------------------------------------------- /test/configCases/context-replacement/b/error.js: -------------------------------------------------------------------------------- 1 | This 2 | should 3 | result 4 | in 5 | an 6 | error 7 | }]) -------------------------------------------------------------------------------- /test/configCases/context-replacement/b/index.js: -------------------------------------------------------------------------------- 1 | it("should replace a context with a new regExp", function() { 2 | function rqInContext(x) { 3 | return require(x); 4 | } 5 | rqInContext("./only-this").should.be.eql("ok"); 6 | }); -------------------------------------------------------------------------------- /test/configCases/context-replacement/b/only-this.js: -------------------------------------------------------------------------------- 1 | module.exports = "ok"; -------------------------------------------------------------------------------- /test/configCases/context-replacement/b/warnings.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Critical dependencies/, /b\/index\.js/] 3 | ]; -------------------------------------------------------------------------------- /test/configCases/context-replacement/b/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | var webpack = require("../../../../"); 3 | 4 | module.exports = { 5 | plugins: [ 6 | new webpack.ContextReplacementPlugin(/context-replacement.b$/, /^\.\/only/) 7 | ] 8 | }; -------------------------------------------------------------------------------- /test/configCases/dedupe/in-chunk/a/dedupe.js: -------------------------------------------------------------------------------- 1 | module.exports = {ok: 1}; -------------------------------------------------------------------------------- /test/configCases/dedupe/in-chunk/b/dedupe.js: -------------------------------------------------------------------------------- 1 | module.exports = {ok: 1}; -------------------------------------------------------------------------------- /test/configCases/dedupe/in-chunk/index.js: -------------------------------------------------------------------------------- 1 | it("should allow to dedupe only in a chunk", function (done) { 2 | require(["./a/dedupe", "./b/dedupe"], function(a, b) { 3 | a.should.be.eql({ok: 1}); 4 | b.should.be.eql({ok: 1}); 5 | a.should.be.not.equal(b); 6 | done(); 7 | }) 8 | }); 9 | -------------------------------------------------------------------------------- /test/configCases/dedupe/in-chunk/webpack.config.js: -------------------------------------------------------------------------------- 1 | var DedupePlugin = require("../../../../lib/optimize/DedupePlugin"); 2 | module.exports = { 3 | plugins: [ 4 | new DedupePlugin(), 5 | ] 6 | }; -------------------------------------------------------------------------------- /test/configCases/delegated/simple/a.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/configCases/delegated/simple/a.js -------------------------------------------------------------------------------- /test/configCases/delegated/simple/b.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/configCases/delegated/simple/b.js -------------------------------------------------------------------------------- /test/configCases/delegated/simple/bundle.js: -------------------------------------------------------------------------------- 1 | module.exports = function(req) { 2 | return ["a", "b", "c"][req]; 3 | } -------------------------------------------------------------------------------- /test/configCases/delegated/simple/dir/c.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/configCases/delegated/simple/dir/c.js -------------------------------------------------------------------------------- /test/configCases/delegated/simple/index.js: -------------------------------------------------------------------------------- 1 | it("should delegate the modules", function() { 2 | require("./a").should.be.eql("a"); 3 | require("./loader!./b").should.be.eql("b"); 4 | require("./dir/c").should.be.eql("c"); 5 | }); 6 | -------------------------------------------------------------------------------- /test/configCases/delegated/simple/loader.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/configCases/delegated/simple/loader.js -------------------------------------------------------------------------------- /test/configCases/delegated/simple/webpack.config.js: -------------------------------------------------------------------------------- 1 | var DelegatedPlugin = require("../../../../lib/DelegatedPlugin"); 2 | module.exports = { 3 | plugins: [ 4 | new DelegatedPlugin({ 5 | source: "./bundle", 6 | type: "require", 7 | context: __dirname, 8 | content: { 9 | "./a.js": 0, 10 | "./loader.js!./b.js": 1, 11 | "./dir/c.js": 2 12 | } 13 | }) 14 | ] 15 | }; 16 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/a.js: -------------------------------------------------------------------------------- 1 | global.order = ["a"]; 2 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/b.js: -------------------------------------------------------------------------------- 1 | global.order.push("b"); 2 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/c.js: -------------------------------------------------------------------------------- 1 | global.order.push("c"); 2 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/d.js: -------------------------------------------------------------------------------- 1 | global.order.push("d"); 2 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/e.js: -------------------------------------------------------------------------------- 1 | global.order.push("e"); 2 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/f.js: -------------------------------------------------------------------------------- 1 | global.order.push("f"); 2 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/g.js: -------------------------------------------------------------------------------- 1 | global.order.push("g"); 2 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/h.js: -------------------------------------------------------------------------------- 1 | global.order.push("h"); 2 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/i.js: -------------------------------------------------------------------------------- 1 | global.order.push("i"); 2 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/j.js: -------------------------------------------------------------------------------- 1 | global.order.push("j"); 2 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/k.js: -------------------------------------------------------------------------------- 1 | global.order.push("k"); 2 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/test.js: -------------------------------------------------------------------------------- 1 | var order = global.order; 2 | delete global.order; 3 | it("should run the modules in the correct order", function() { 4 | order.should.be.eql([ 5 | "a", 6 | "b", 7 | "c", 8 | "d", 9 | "e", 10 | "f", 11 | "g", 12 | "h", 13 | "i", 14 | "j", 15 | "k" 16 | ]); 17 | }); 18 | -------------------------------------------------------------------------------- /test/configCases/entry/issue-1068/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | entry: [ 3 | "./a", 4 | "./b", 5 | "./c", 6 | "./d", 7 | "./e", 8 | "./f", 9 | "./g", 10 | "./h", 11 | "./i", 12 | "./j", 13 | "./k", 14 | "./test" 15 | ] 16 | }; 17 | -------------------------------------------------------------------------------- /test/configCases/entry/require-entry-point/entry-point.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/configCases/entry/require-entry-point/entry-point.js -------------------------------------------------------------------------------- /test/configCases/entry/require-entry-point/entry-point2.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/configCases/entry/require-entry-point/entry-point2.js -------------------------------------------------------------------------------- /test/configCases/entry/require-entry-point/require-entry-point.js: -------------------------------------------------------------------------------- 1 | it("should require entry points fine", function() { 2 | require("./require-entry-point"); 3 | require("./entry-point"); 4 | require("./entry-point2"); 5 | }); 6 | -------------------------------------------------------------------------------- /test/configCases/entry/require-entry-point/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | entry: { 3 | bundle0: "./require-entry-point", 4 | a: "./entry-point", 5 | b: ["./entry-point2"] 6 | }, 7 | output: { 8 | filename: "[name].js" 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /test/configCases/errors/entry-not-found/errors.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/^Entry module not found/, /.\/index\.js/] 3 | ]; -------------------------------------------------------------------------------- /test/configCases/errors/entry-not-found/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = {}; 2 | -------------------------------------------------------------------------------- /test/configCases/externals/optional-externals-cjs/index.js: -------------------------------------------------------------------------------- 1 | it("should not fail on optional externals", function() { 2 | try { 3 | require("external"); 4 | } catch(e) { 5 | e.should.be.instanceof(Error); 6 | e.code.should.be.eql("MODULE_NOT_FOUND"); 7 | return; 8 | } 9 | throw new Error("It doesn't fail"); 10 | }); -------------------------------------------------------------------------------- /test/configCases/externals/optional-externals-cjs/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | libraryTarget: "commonjs2" 4 | }, 5 | externals: { 6 | external: "external" 7 | } 8 | }; -------------------------------------------------------------------------------- /test/configCases/externals/optional-externals-root/index.js: -------------------------------------------------------------------------------- 1 | it("should not fail on optional externals", function() { 2 | try { 3 | require("external"); 4 | } catch(e) { 5 | e.should.be.instanceof(Error); 6 | e.code.should.be.eql("MODULE_NOT_FOUND"); 7 | return; 8 | } 9 | throw new Error("It doesn't fail"); 10 | }); -------------------------------------------------------------------------------- /test/configCases/externals/optional-externals-root/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | libraryTarget: "var" 4 | }, 5 | externals: { 6 | external: "external" 7 | } 8 | }; -------------------------------------------------------------------------------- /test/configCases/externals/optional-externals-umd/index.js: -------------------------------------------------------------------------------- 1 | it("should not fail on optional externals", function() { 2 | try { 3 | require("external"); 4 | } catch(e) { 5 | e.should.be.instanceof(Error); 6 | e.code.should.be.eql("MODULE_NOT_FOUND"); 7 | return; 8 | } 9 | throw new Error("It doesn't fail"); 10 | }); -------------------------------------------------------------------------------- /test/configCases/externals/optional-externals-umd/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | libraryTarget: "umd" 4 | }, 5 | externals: { 6 | external: "external" 7 | } 8 | }; -------------------------------------------------------------------------------- /test/configCases/externals/optional-externals-umd2-mixed/index.js: -------------------------------------------------------------------------------- 1 | it("should not fail on optional externals", function() { 2 | require("external2"); 3 | try { 4 | require("external"); 5 | } catch(e) { 6 | e.should.be.instanceof(Error); 7 | e.code.should.be.eql("MODULE_NOT_FOUND"); 8 | return; 9 | } 10 | throw new Error("It doesn't fail"); 11 | }); -------------------------------------------------------------------------------- /test/configCases/externals/optional-externals-umd2-mixed/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | libraryTarget: "umd2" 4 | }, 5 | externals: { 6 | external: "external", 7 | external2: "fs" 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /test/configCases/externals/optional-externals-umd2/index.js: -------------------------------------------------------------------------------- 1 | it("should not fail on optional externals", function() { 2 | try { 3 | require("external"); 4 | } catch(e) { 5 | e.should.be.instanceof(Error); 6 | e.code.should.be.eql("MODULE_NOT_FOUND"); 7 | return; 8 | } 9 | throw new Error("It doesn't fail"); 10 | }); -------------------------------------------------------------------------------- /test/configCases/externals/optional-externals-umd2/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | libraryTarget: "umd2" 4 | }, 5 | externals: { 6 | external: "external" 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /test/configCases/extract-text/issue-14/base.css: -------------------------------------------------------------------------------- 1 | body{base:0} -------------------------------------------------------------------------------- /test/configCases/extract-text/issue-14/styleA.css: -------------------------------------------------------------------------------- 1 | @import "base.css";body{a:1} -------------------------------------------------------------------------------- /test/configCases/extract-text/issue-14/styleB.css: -------------------------------------------------------------------------------- 1 | @import "base.css";body{b:2} -------------------------------------------------------------------------------- /test/configCases/extract-text/issue-14/webpack.config.js: -------------------------------------------------------------------------------- 1 | var ETP = require("extract-text-webpack-plugin"); 2 | module.exports = { 3 | node: { 4 | __dirname: false, 5 | __filename: false 6 | }, 7 | module: { 8 | loaders: [ 9 | { 10 | test: /\.css$/, 11 | loader: ETP.extract("css-loader") 12 | } 13 | ] 14 | }, 15 | plugins: [ 16 | new ETP("style.css") 17 | ] 18 | }; -------------------------------------------------------------------------------- /test/configCases/filename-template/module-filename-template/index.js: -------------------------------------------------------------------------------- 1 | it("should include test.js in SourceMap", function() { 2 | var fs = require("fs"); 3 | var source = fs.readFileSync(__filename + ".map", "utf-8"); 4 | var map = JSON.parse(source); 5 | map.sources.should.containEql("dummy:///./test.js"); 6 | }); 7 | 8 | require.include("./test.js"); 9 | 10 | -------------------------------------------------------------------------------- /test/configCases/filename-template/module-filename-template/test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/configCases/filename-template/module-filename-template/test.js -------------------------------------------------------------------------------- /test/configCases/filename-template/module-filename-template/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | lineToLine: true, 4 | devtoolModuleFilenameTemplate: function(info) { 5 | return "dummy:///" + info.resourcePath; 6 | } 7 | }, 8 | node: { 9 | __dirname: false, 10 | __filename: false 11 | }, 12 | devtool: "cheap-source-map" 13 | 14 | }; 15 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file1.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file10.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file11.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file12.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file13.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file14.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file15.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file2.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file3.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file4.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file5.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file6.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file7.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file8.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/files/file9.js: -------------------------------------------------------------------------------- 1 | module.exports = module.id; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/hashed-module-ids/index.js: -------------------------------------------------------------------------------- 1 | it("should have unique ids", function () { 2 | var ids = []; 3 | for(var i = 1; i <= 15; i++) { 4 | var id = require("./files/file" + i + ".js"); 5 | ids.indexOf(id).should.be.eql(-1); 6 | ids.push(id); 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /test/configCases/hash-length/output-filename/chunk.js: -------------------------------------------------------------------------------- 1 | module.exports = "chunk"; 2 | -------------------------------------------------------------------------------- /test/configCases/hash-length/output-filename/index.js: -------------------------------------------------------------------------------- 1 | it("should compile and run the test " + NAME, function () {}); 2 | 3 | it("should load additional chunks in " + NAME, function (done) { 4 | require(['./chunk'], function () { 5 | done(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /test/configCases/library/a/index.js: -------------------------------------------------------------------------------- 1 | it("should run", function() { 2 | 3 | }); -------------------------------------------------------------------------------- /test/configCases/library/a/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | libraryTarget: "this" 4 | } 5 | }; -------------------------------------------------------------------------------- /test/configCases/library/b/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | libraryTarget: "global" 4 | } 5 | }; -------------------------------------------------------------------------------- /test/configCases/parsing/context/index.js: -------------------------------------------------------------------------------- 1 | it("should automatically create contexts", function() { 2 | var template = "tmpl", templateFull = "./tmpl.js"; 3 | require("../../../cases/parsing/context/templates/templateLoader")(templateFull).should.be.eql("test template"); 4 | require("../../../cases/parsing/context/templates/templateLoaderIndirect")(templateFull).should.be.eql("test template"); 5 | }); -------------------------------------------------------------------------------- /test/configCases/parsing/context/warnings.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/Module parse failed/, /dump-file\.txt/, /templates \^\\\.\\\//] 3 | ]; -------------------------------------------------------------------------------- /test/configCases/parsing/context/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | module: { 3 | unknownContextRegExp: /^\.\//, 4 | unknownContextCritical: false, 5 | exprContextRegExp: /^\.\//, 6 | exprContextCritical: false 7 | } 8 | }; -------------------------------------------------------------------------------- /test/configCases/parsing/extended-api/index.js: -------------------------------------------------------------------------------- 1 | it("should have __webpack_hash__", function() { 2 | (typeof __webpack_hash__).should.be.type("string"); 3 | __webpack_hash__.should.match(/^[0-9a-f]{20}$/); 4 | }); -------------------------------------------------------------------------------- /test/configCases/parsing/extended-api/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../../../"); 2 | 3 | module.exports = { 4 | plugins: [ 5 | new webpack.ExtendedAPIPlugin() 6 | ] 7 | }; -------------------------------------------------------------------------------- /test/configCases/parsing/issue-336/index.js: -------------------------------------------------------------------------------- 1 | it("should provide a module to a free var in a var decl", function() { 2 | var x = aaa.test; 3 | x.should.be.eql("test"); 4 | }); -------------------------------------------------------------------------------- /test/configCases/parsing/issue-336/node_modules/aaa.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | test: "test" 3 | }; -------------------------------------------------------------------------------- /test/configCases/parsing/issue-336/webpack.config.js: -------------------------------------------------------------------------------- 1 | var ProvidePlugin = require("../../../../lib/ProvidePlugin"); 2 | module.exports = { 3 | plugins: [ 4 | new ProvidePlugin({ 5 | aaa: "aaa" 6 | }) 7 | ] 8 | }; -------------------------------------------------------------------------------- /test/configCases/parsing/relative-filedirname/dir/file.js: -------------------------------------------------------------------------------- 1 | exports.filename = __filename; 2 | exports.dirname = __dirname; 3 | -------------------------------------------------------------------------------- /test/configCases/parsing/relative-filedirname/index.js: -------------------------------------------------------------------------------- 1 | it("should define __dirname and __filename", function() { 2 | __dirname.should.be.eql(""); 3 | __filename.should.be.eql("index.js"); 4 | require("./dir/file").dirname.should.be.eql("dir"); 5 | require("./dir/file").filename.should.match(/^dir[\\\/]file.js$/); 6 | }); -------------------------------------------------------------------------------- /test/configCases/parsing/relative-filedirname/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | node: { 3 | __filename: true, 4 | __dirname: true 5 | } 6 | }; -------------------------------------------------------------------------------- /test/configCases/parsing/require.main/index.js: -------------------------------------------------------------------------------- 1 | it("should define require.main", function() { 2 | require.main.should.be.eql(module); 3 | }); 4 | -------------------------------------------------------------------------------- /test/configCases/parsing/require.main/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | }; -------------------------------------------------------------------------------- /test/configCases/plugins/banner-plugin/test.js: -------------------------------------------------------------------------------- 1 | var foo = {}; 2 | 3 | module.exports = foo; 4 | -------------------------------------------------------------------------------- /test/configCases/plugins/banner-plugin/vendors.js: -------------------------------------------------------------------------------- 1 | var bar = {}; 2 | 3 | module.exports = bar; 4 | -------------------------------------------------------------------------------- /test/configCases/plugins/define-plugin/a.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/configCases/plugins/define-plugin/a.js -------------------------------------------------------------------------------- /test/configCases/plugins/environment-plugin/errors.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/(aaa)/, /resolve 'bbb'/], 3 | [/(aaa)/, /resolve 'ccc'/], 4 | [/(aaa)/, /resolve 'ddd'/], 5 | [/(bbbccc)/, /resolve 'aaa'/], 6 | [/(bbbccc)/, /resolve 'ddd'/], 7 | [/(ddd)/, /resolve 'aaa'/], 8 | [/(ddd)/, /resolve 'bbb'/], 9 | [/(ddd)/, /resolve 'ccc'/], 10 | [/(ddd)/, /resolve 'ddd'/], 11 | ]; 12 | -------------------------------------------------------------------------------- /test/configCases/plugins/environment-plugin/warnings.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/(ddd)/, /DDD environment variable is undefined./] 3 | ]; 4 | -------------------------------------------------------------------------------- /test/configCases/plugins/lib-manifest-plugin/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "a"; 2 | -------------------------------------------------------------------------------- /test/configCases/plugins/loader-options-plugin/index.js: -------------------------------------------------------------------------------- 1 | it("should set correct options on js files", function() { 2 | require("./loader!./index.js").should.be.eql({ 3 | minimize: true, 4 | jsfile: true 5 | }); 6 | }); 7 | it("should set correct options on other files", function() { 8 | require("./loader!./txt.txt").should.be.eql({ 9 | minimize: true 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /test/configCases/plugins/loader-options-plugin/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return "module.exports = " + JSON.stringify({ 3 | minimize: this.minimize, 4 | jsfile: this.jsfile 5 | }); 6 | }; 7 | -------------------------------------------------------------------------------- /test/configCases/plugins/loader-options-plugin/txt.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/configCases/plugins/loader-options-plugin/txt.txt -------------------------------------------------------------------------------- /test/configCases/plugins/loader-options-plugin/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../../../"); 2 | 3 | module.exports = { 4 | plugins: [ 5 | new webpack.LoaderOptionsPlugin({ 6 | minimize: true 7 | }), 8 | new webpack.LoaderOptionsPlugin({ 9 | test: /\.js$/, 10 | jsfile: true 11 | }) 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /test/configCases/plugins/new-watching-plugin/index.js: -------------------------------------------------------------------------------- 1 | it("should run", function() {}); -------------------------------------------------------------------------------- /test/configCases/plugins/new-watching-plugin/warnings.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | [/no longer necessary/], 3 | ]; 4 | -------------------------------------------------------------------------------- /test/configCases/plugins/new-watching-plugin/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../../../"); 2 | module.exports = { 3 | plugins: [ 4 | new webpack.NewWatchingPlugin() 5 | ] 6 | }; 7 | -------------------------------------------------------------------------------- /test/configCases/plugins/provide-plugin/aaa.js: -------------------------------------------------------------------------------- 1 | module.exports = "aaa"; -------------------------------------------------------------------------------- /test/configCases/plugins/provide-plugin/bbbccc.js: -------------------------------------------------------------------------------- 1 | module.exports = "bbbccc"; -------------------------------------------------------------------------------- /test/configCases/plugins/provide-plugin/env.js: -------------------------------------------------------------------------------- 1 | module.exports = "development"; -------------------------------------------------------------------------------- /test/configCases/plugins/provide-plugin/webpack.config.js: -------------------------------------------------------------------------------- 1 | var ProvidePlugin = require("../../../../lib/ProvidePlugin"); 2 | module.exports = { 3 | plugins: [ 4 | new ProvidePlugin({ 5 | aaa: "./aaa", 6 | "bbb.ccc": "./bbbccc", 7 | "process.env.NODE_ENV": "./env", 8 | }) 9 | ] 10 | }; 11 | -------------------------------------------------------------------------------- /test/configCases/plugins/uglifyjs-plugin/test.js: -------------------------------------------------------------------------------- 1 | /** @preserve comment should be stripped test.1 */ 2 | 3 | var foo = {}; 4 | 5 | // comment should be stripped test.2 6 | 7 | /** 8 | * comment should be stripped test.3 9 | */ 10 | 11 | module.exports = foo; 12 | -------------------------------------------------------------------------------- /test/configCases/plugins/uglifyjs-plugin/vendors.js: -------------------------------------------------------------------------------- 1 | /** @preserve comment should not be stripped vendors.1 */ 2 | 3 | var bar = {}; 4 | 5 | // comment should not be stripped vendors.2 6 | 7 | /** 8 | * comment should not be stripped vendors.3 9 | */ 10 | 11 | module.exports = bar; 12 | -------------------------------------------------------------------------------- /test/configCases/plugins/watch-ignore-plugin/index.js: -------------------------------------------------------------------------------- 1 | it("should run", function() {}); 2 | -------------------------------------------------------------------------------- /test/configCases/plugins/watch-ignore-plugin/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../../../"); 2 | 3 | module.exports = { 4 | plugins: [ 5 | new webpack.WatchIgnorePlugin() 6 | ] 7 | }; 8 | -------------------------------------------------------------------------------- /test/configCases/records/issue-295/file.js: -------------------------------------------------------------------------------- 1 | // just a file -------------------------------------------------------------------------------- /test/configCases/records/issue-295/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | return source; 3 | }; 4 | -------------------------------------------------------------------------------- /test/configCases/records/issue-295/test.js: -------------------------------------------------------------------------------- 1 | require("./loader!./file"); 2 | require("./loader?2!./file"); 3 | 4 | it("should write relative paths to records", function() { 5 | var fs = require("fs"); 6 | var path = require("path"); 7 | var content = fs.readFileSync(path.join(__dirname, "records.json"), "utf-8"); 8 | content.should.not.match(/webpack|issue/); 9 | }); 10 | -------------------------------------------------------------------------------- /test/configCases/records/issue-295/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | var webpack = require("../../../../"); 3 | module.exports = { 4 | entry: "./test", 5 | recordsPath: path.resolve(__dirname, "../../../js/config/records/issue-295/records.json"), 6 | target: "node", 7 | node: { 8 | __dirname: false 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /test/configCases/simple/empty-config/index.js: -------------------------------------------------------------------------------- 1 | it("should compile and run the test", function() { 2 | 3 | }); -------------------------------------------------------------------------------- /test/configCases/simple/empty-config/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 3 | }; -------------------------------------------------------------------------------- /test/configCases/simple/multi-compiler/index.js: -------------------------------------------------------------------------------- 1 | it("should run a multi compiler", function() { 2 | 3 | }); -------------------------------------------------------------------------------- /test/configCases/simple/multi-compiler/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | var webpack = require("../../../../"); 3 | 4 | module.exports = [ 5 | { 6 | 7 | } 8 | ]; -------------------------------------------------------------------------------- /test/configCases/source-map/exclude-chunks-source-map/test.js: -------------------------------------------------------------------------------- 1 | var foo = {}; 2 | 3 | module.exports = foo; 4 | -------------------------------------------------------------------------------- /test/configCases/source-map/exclude-chunks-source-map/vendors.js: -------------------------------------------------------------------------------- 1 | var bar = {}; 2 | 3 | module.exports = bar; 4 | -------------------------------------------------------------------------------- /test/configCases/source-map/line-to-line/index.js: -------------------------------------------------------------------------------- 1 | it("should include test.js in SourceMap", function() { 2 | var fs = require("fs"); 3 | var source = fs.readFileSync(__filename + ".map", "utf-8"); 4 | var map = JSON.parse(source); 5 | map.sources.should.containEql("webpack:///./test.js"); 6 | }); 7 | 8 | require.include("./test.js"); 9 | -------------------------------------------------------------------------------- /test/configCases/source-map/line-to-line/test.js: -------------------------------------------------------------------------------- 1 | var foo = {}; 2 | 3 | module.exports = foo; -------------------------------------------------------------------------------- /test/configCases/source-map/line-to-line/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | lineToLine: true 4 | }, 5 | node: { 6 | __dirname: false, 7 | __filename: false 8 | }, 9 | devtool: "cheap-source-map" 10 | }; -------------------------------------------------------------------------------- /test/configCases/source-map/relative-source-map-path/test.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"); 2 | var source = fs.readFileSync(__filename, "utf-8"); 3 | var match = /sourceMappingURL\s*=\s*(.*)/.exec(source); 4 | match[1].should.be.eql("c.js.map"); -------------------------------------------------------------------------------- /test/configCases/source-map/relative-source-map-path/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | chunkFilename: "js/chunks/c.js" 4 | }, 5 | node: { 6 | __dirname: false, 7 | __filename: false 8 | }, 9 | devtool: "source-map" 10 | }; -------------------------------------------------------------------------------- /test/configCases/source-map/sources-array-production-cheap-map/index.js: -------------------------------------------------------------------------------- 1 | it("should include test.js in SourceMap", function() { 2 | var fs = require("fs"); 3 | var source = fs.readFileSync(__filename + ".map", "utf-8"); 4 | var map = JSON.parse(source); 5 | map.sources.should.containEql("webpack:///./test.js"); 6 | }); 7 | 8 | require.include("./test.js"); 9 | -------------------------------------------------------------------------------- /test/configCases/source-map/sources-array-production-cheap-map/test.js: -------------------------------------------------------------------------------- 1 | var foo = {}; 2 | 3 | module.exports = foo; -------------------------------------------------------------------------------- /test/configCases/source-map/sources-array-production-cheap-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../../../"); 2 | module.exports = { 3 | node: { 4 | __dirname: false, 5 | __filename: false 6 | }, 7 | plugins: [ 8 | new webpack.SourceMapDevToolPlugin({ 9 | filename: "[file].map", 10 | cheap: true 11 | }), 12 | new webpack.optimize.UglifyJsPlugin() 13 | ] 14 | }; -------------------------------------------------------------------------------- /test/configCases/source-map/sources-array-production/index.js: -------------------------------------------------------------------------------- 1 | it("should include test.js in SourceMap", function() { 2 | var fs = require("fs"); 3 | var source = fs.readFileSync(__filename + ".map", "utf-8"); 4 | var map = JSON.parse(source); 5 | map.sources.should.containEql("webpack:///./test.js"); 6 | }); 7 | 8 | require.include("./test.js"); 9 | -------------------------------------------------------------------------------- /test/configCases/source-map/sources-array-production/test.js: -------------------------------------------------------------------------------- 1 | var foo = {}; 2 | 3 | module.exports = foo; -------------------------------------------------------------------------------- /test/configCases/source-map/sources-array-production/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require("../../../../"); 2 | module.exports = { 3 | node: { 4 | __dirname: false, 5 | __filename: false 6 | }, 7 | devtool: "source-map", 8 | plugins: [ 9 | new webpack.optimize.UglifyJsPlugin() 10 | ] 11 | }; -------------------------------------------------------------------------------- /test/configCases/target/buffer-default/index.js: -------------------------------------------------------------------------------- 1 | require("should"); 2 | 3 | it("should provide a global Buffer shim", function () { 4 | Buffer.should.be.a.Function; 5 | }); 6 | 7 | it("should provide the buffer module", function () { 8 | var buffer = require("buffer"); 9 | (typeof buffer).should.be.eql("object"); 10 | }); 11 | -------------------------------------------------------------------------------- /test/configCases/target/buffer-default/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | target: "web", 3 | }; 4 | -------------------------------------------------------------------------------- /test/configCases/target/buffer/index.js: -------------------------------------------------------------------------------- 1 | require("should"); 2 | 3 | it("should provide a global Buffer shim", function () { 4 | Buffer.should.be.a.Function; 5 | }); 6 | 7 | it("should fail on the buffer module"/*, function () { 8 | (function(argument) { 9 | try { 10 | require("buffer"); 11 | } catch(e) { throw e; } 12 | }).should.throw(); 13 | }*/); 14 | -------------------------------------------------------------------------------- /test/configCases/target/buffer/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | target: "web", 3 | node: { 4 | Buffer: true, 5 | buffer: false 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /test/configCases/target/umd-named-define/index.js: -------------------------------------------------------------------------------- 1 | it("should run", function() { 2 | 3 | }); 4 | 5 | it("should name define", function() { 6 | var fs = require("fs"); 7 | var source = fs.readFileSync(__filename, "utf-8"); 8 | 9 | source.should.containEql("define(\"NamedLibrary\","); 10 | }); 11 | -------------------------------------------------------------------------------- /test/configCases/target/umd-named-define/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: { 3 | library: "NamedLibrary", 4 | libraryTarget: "umd", 5 | umdNamedDefine: true 6 | }, 7 | node: { 8 | __dirname: false, 9 | __filename: false 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /test/configCases/target/web/node_modules/process/in.js: -------------------------------------------------------------------------------- 1 | module.exports = "in process"; 2 | -------------------------------------------------------------------------------- /test/configCases/target/web/node_modules/process/index.js: -------------------------------------------------------------------------------- 1 | throw new Error("Should not be loaded"); 2 | -------------------------------------------------------------------------------- /test/configCases/target/web/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | target: "web" 3 | }; -------------------------------------------------------------------------------- /test/fixtures/a.js: -------------------------------------------------------------------------------- 1 | module.exports = function a() { 2 | return "This is a"; 3 | }; -------------------------------------------------------------------------------- /test/fixtures/abc.js: -------------------------------------------------------------------------------- 1 | exports.a = require("./a"); 2 | exports.b = require("./b"); 3 | exports.c = require("./c"); -------------------------------------------------------------------------------- /test/fixtures/abc.txt: -------------------------------------------------------------------------------- 1 | abc -------------------------------------------------------------------------------- /test/fixtures/b.js: -------------------------------------------------------------------------------- 1 | module.exports = function b() { 2 | return "This is b"; 3 | }; -------------------------------------------------------------------------------- /test/fixtures/c.js: -------------------------------------------------------------------------------- 1 | module.exports = function b() { 2 | require("./a"); 3 | return "This is c"; 4 | }; -------------------------------------------------------------------------------- /test/fixtures/chunks.js: -------------------------------------------------------------------------------- 1 | require.ensure(["./a"], function(require) { 2 | require("./b"); 3 | }); -------------------------------------------------------------------------------- /test/fixtures/errors/case-sensitive.js: -------------------------------------------------------------------------------- 1 | require("./file"); 2 | require("./FILE"); -------------------------------------------------------------------------------- /test/fixtures/errors/entry-point.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/fixtures/errors/entry-point.js -------------------------------------------------------------------------------- /test/fixtures/errors/file.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/fixtures/errors/file.js -------------------------------------------------------------------------------- /test/fixtures/errors/missingFile.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | // on line 4 4 | require("./missing"); 5 | 6 | 7 | 8 | 9 | 10 | 11 | // on line 12 char 10 12 | require("./dir/missing2"); -------------------------------------------------------------------------------- /test/fixtures/errors/require.extensions.js: -------------------------------------------------------------------------------- 1 | require.extensions[".js"] = function() {}; -------------------------------------------------------------------------------- /test/fixtures/items/item (0).js: -------------------------------------------------------------------------------- 1 | module.exports = 0; -------------------------------------------------------------------------------- /test/fixtures/items/item (1).js: -------------------------------------------------------------------------------- 1 | module.exports = 1; -------------------------------------------------------------------------------- /test/fixtures/items/item (2).js: -------------------------------------------------------------------------------- 1 | module.exports = 2; -------------------------------------------------------------------------------- /test/fixtures/items/item (3).js: -------------------------------------------------------------------------------- 1 | module.exports = 3; -------------------------------------------------------------------------------- /test/fixtures/items/item (4).js: -------------------------------------------------------------------------------- 1 | module.exports = 4; -------------------------------------------------------------------------------- /test/fixtures/items/item (5).js: -------------------------------------------------------------------------------- 1 | module.exports = 5; -------------------------------------------------------------------------------- /test/fixtures/items/item (6).js: -------------------------------------------------------------------------------- 1 | module.exports = 6; -------------------------------------------------------------------------------- /test/fixtures/items/item (7).js: -------------------------------------------------------------------------------- 1 | module.exports = 7; -------------------------------------------------------------------------------- /test/fixtures/items/item (8).js: -------------------------------------------------------------------------------- 1 | module.exports = 8; -------------------------------------------------------------------------------- /test/fixtures/items/item (9).js: -------------------------------------------------------------------------------- 1 | module.exports = 9; -------------------------------------------------------------------------------- /test/fixtures/lib/complex1.js: -------------------------------------------------------------------------------- 1 | module.exports = "lib complex1"; -------------------------------------------------------------------------------- /test/fixtures/main1.js: -------------------------------------------------------------------------------- 1 | var a = require("./a"); 2 | if(x) { 3 | for(var i = 0; i < 100; i++) { 4 | while(true) 5 | require("./b"); 6 | do { 7 | i++; 8 | } while(require("m1/a")()); 9 | } 10 | } -------------------------------------------------------------------------------- /test/fixtures/main2.js: -------------------------------------------------------------------------------- 1 | var a = require("./a"); 2 | with(x) { 3 | switch(a) { 4 | case 1: 5 | require("./b"); 6 | default: 7 | require.ensure(["m1/a"], function() { 8 | var a = require("m1/a"), 9 | b = require("m1/b"); 10 | }); 11 | } 12 | } -------------------------------------------------------------------------------- /test/fixtures/main3.js: -------------------------------------------------------------------------------- 1 | var a = require("./a"); 2 | require.ensure([], function(require) { 3 | require("./c.js"); 4 | }); -------------------------------------------------------------------------------- /test/fixtures/main4.js: -------------------------------------------------------------------------------- 1 | var six = 6; 2 | require("bundle!./items/item (" + six + ")"); -------------------------------------------------------------------------------- /test/fixtures/node_modules/complexm/step1.js: -------------------------------------------------------------------------------- 1 | module.exports = require("m1/a") + require("m1"); -------------------------------------------------------------------------------- /test/fixtures/node_modules/complexm/step2.js: -------------------------------------------------------------------------------- 1 | module.exports = "Step2"; -------------------------------------------------------------------------------- /test/fixtures/node_modules/complexm/web_modules/m1/a.js: -------------------------------------------------------------------------------- 1 | module.exports = "the correct a.js"; -------------------------------------------------------------------------------- /test/fixtures/node_modules/complexm/web_modules/m1/index.js: -------------------------------------------------------------------------------- 1 | module.exports = " :) " + require("m2/b.js"); -------------------------------------------------------------------------------- /test/fixtures/node_modules/m1/a.js: -------------------------------------------------------------------------------- 1 | module.exports = function a() { 2 | return "This is m1/a"; 3 | }; -------------------------------------------------------------------------------- /test/fixtures/node_modules/m1/b.js: -------------------------------------------------------------------------------- 1 | module.exports = function a() { 2 | return "This is m1/b"; 3 | }; -------------------------------------------------------------------------------- /test/fixtures/node_modules/m2-loader/b.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | "module.exports = 'This is m2-loader/b';"; 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/node_modules/m2/b.js: -------------------------------------------------------------------------------- 1 | module.exports = "This is m2/b"; 2 | -------------------------------------------------------------------------------- /test/fixtures/nodetest/entry.js: -------------------------------------------------------------------------------- 1 | exports.loadChunk = function(id, cb) { 2 | require(["./file" + id], function(result) { 3 | cb(result); 4 | }); 5 | }; 6 | exports.nextTick = process.nextTick; 7 | exports.fs = require("fs"); -------------------------------------------------------------------------------- /test/fixtures/nodetest/file456.js: -------------------------------------------------------------------------------- 1 | module.exports = 123; -------------------------------------------------------------------------------- /test/fixtures/nodetest/file567.js: -------------------------------------------------------------------------------- 1 | define({ 2 | a: 1 3 | }); -------------------------------------------------------------------------------- /test/fixtures/subdir/watched-file.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/fixtures/subdir/watched-file.txt -------------------------------------------------------------------------------- /test/fixtures/watched-file.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yyx990803/webpack/d01c6b63daa49cb50640f4bcc9d3e2c54e608edd/test/fixtures/watched-file.txt -------------------------------------------------------------------------------- /test/hotCases/fake-update-loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable(false); 3 | var idx = this.options.updateIndex; 4 | var items = source.split(/---+\r?\n/g); 5 | return items[idx] || items[items.length - 1]; 6 | } -------------------------------------------------------------------------------- /test/hotCases/harmony/auto-import-multiple/commonjs.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | --- 3 | module.exports = 20; 4 | -------------------------------------------------------------------------------- /test/hotCases/harmony/auto-import-multiple/file.js: -------------------------------------------------------------------------------- 1 | export var value = 1; 2 | --- 3 | export var value = 2; 4 | -------------------------------------------------------------------------------- /test/hotCases/harmony/auto-import/file.js: -------------------------------------------------------------------------------- 1 | export var value = 1; 2 | --- 3 | export var value = 2; 4 | -------------------------------------------------------------------------------- /test/hotCases/harmony/auto-import/index.js: -------------------------------------------------------------------------------- 1 | import { value } from "./file"; 2 | 3 | it("should auto-import a ES6 imported value on accept", function(done) { 4 | value.should.be.eql(1); 5 | module.hot.accept("./file", function() { 6 | value.should.be.eql(2); 7 | outside(); 8 | done(); 9 | }); 10 | NEXT(require("../../update")(done)); 11 | }); 12 | 13 | function outside() { 14 | value.should.be.eql(2); 15 | } 16 | -------------------------------------------------------------------------------- /test/hotCases/runtime/accept/file.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | --- 3 | module.exports = 2; 4 | -------------------------------------------------------------------------------- /test/hotCases/runtime/accept/index.js: -------------------------------------------------------------------------------- 1 | var value = require("./file"); 2 | 3 | it("should accept a dependencies and require a new value", function(done) { 4 | value.should.be.eql(1); 5 | module.hot.accept("./file", function() { 6 | value = require("./file"); 7 | value.should.be.eql(2); 8 | outside(); 9 | done(); 10 | }); 11 | NEXT(require("../../update")(done)); 12 | }); 13 | 14 | function outside() { 15 | value.should.be.eql(2); 16 | } 17 | -------------------------------------------------------------------------------- /test/hotCases/runtime/bubble-update/file.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | --- 3 | module.exports = 2; 4 | -------------------------------------------------------------------------------- /test/hotCases/runtime/bubble-update/index.js: -------------------------------------------------------------------------------- 1 | var value = require("./parent-file"); 2 | 3 | it("should bubble update from a nested dependency", function(done) { 4 | value.should.be.eql(1); 5 | module.hot.accept("./parent-file", function() { 6 | value = require("./parent-file"); 7 | value.should.be.eql(2); 8 | done(); 9 | }); 10 | NEXT(require("../../update")(done)); 11 | }); 12 | -------------------------------------------------------------------------------- /test/hotCases/runtime/bubble-update/parent-file.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./file"); 2 | -------------------------------------------------------------------------------- /test/hotCases/runtime/self-accept-and-dispose/file.js: -------------------------------------------------------------------------------- 1 | var callback; 2 | 3 | module.hot.accept(); 4 | module.hot.dispose(function(data) { 5 | data.callback = callback; 6 | }); 7 | 8 | module.exports = function(cb) { 9 | callback = cb; 10 | } 11 | 12 | --- 13 | 14 | module.hot.data.callback(); 15 | -------------------------------------------------------------------------------- /test/hotCases/runtime/self-accept-and-dispose/index.js: -------------------------------------------------------------------------------- 1 | it("should accept itself and pass data", function(done) { 2 | require("./file")(done); 3 | NEXT(require("../../update")(done)); 4 | }); 5 | -------------------------------------------------------------------------------- /test/hotCases/runtime/update-multiple-modules/fileA.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | --- 3 | module.exports = 2; 4 | -------------------------------------------------------------------------------- /test/hotCases/runtime/update-multiple-modules/fileB.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | --- 3 | module.exports = 2; 4 | -------------------------------------------------------------------------------- /test/hotCases/runtime/update-multiple-modules/index.js: -------------------------------------------------------------------------------- 1 | var value = require("./parent-file"); 2 | 3 | it("should update multiple modules at the same time", function(done) { 4 | value.should.be.eql(2); 5 | module.hot.accept("./parent-file", function() { 6 | value = require("./parent-file"); 7 | value.should.be.eql(4); 8 | done(); 9 | }); 10 | NEXT(require("../../update")(done)); 11 | }); 12 | -------------------------------------------------------------------------------- /test/hotCases/runtime/update-multiple-modules/parent-file.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./fileA") + require("./fileB"); 2 | -------------------------------------------------------------------------------- /test/hotCases/runtime/update-multiple-times/file.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | --- 3 | module.exports = 2; 4 | --- 5 | module.exports = 3; 6 | --- 7 | module.exports = 4; 8 | --- 9 | module.exports = 5; 10 | -------------------------------------------------------------------------------- /test/hotCases/update.js: -------------------------------------------------------------------------------- 1 | module.exports = function(done) { 2 | return function() { 3 | module.hot.check(true).catch(function(err) { 4 | done(err); 5 | }); 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /test/hotPlayground/.gitignore: -------------------------------------------------------------------------------- 1 | *bundle-update.js 2 | bundle.js 3 | records.json -------------------------------------------------------------------------------- /test/hotPlayground/applyStyle2.js: -------------------------------------------------------------------------------- 1 | // This file can update, because it accept itself. 2 | // A dispose handler removes the old