const path = require("path");
module.exports = {
mode: "production",
entry: "./app/entry",
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
publicPath: "auto",
library: {
type: "var",
name: undefined,
export: undefined,
auxiliaryComment: "comment",
umdNamedDefine: undefined,
},
uniqueName: "기본값은 package.json 파일의 name 속성",
name: undefined,
chunkFilename: "[id].js",
assetModuleFilename: "[hash][ext][query]",
webassemblyModuleFilename: "[hash].module.wasm",
sourceMapFilename: "[file].map[query]",
devtoolModuleFilenameTemplate:
"webpack://[namespace]/[resource-path]?[loaders]",
devtoolFallbackModuleFilenameTemplate: undefined,
crossOriginLoading: false,
importFunctionName: "import",
importMetaName: "import.meta",
pathinfo: true,
charset: true,
chunkLoadTimeout: 120000,
compareBeforeEmit: true,
strictModuleExceptionHandling: false,
devtoolNamespace: output.uniqueName,
environment: {
arrowFunction: true,
bigIntLiteral: false,
const: true,
destructuring: true,
dynamicImport: false,
forOf: true,
module: false,
},
globalObject: "self",
iife: true,
module: false,
scriptType: false,
chunkLoading: "jsonp",
chunkLoadingGlobal: "webpackChunkwebpack",
enabledChunkLoadingTypes: ["jsonp", "import-scripts"],
enabledLibraryTypes: [],
enabledWasmLoadingTypes: ["fetch"],
chunkFormat: "array-push",
hotUpdateMainFilename: "[runtime].[fullhash].hot-update.json",
hotUpdateChunkFilename: "[id].[fullhash].hot-update.js",
hotUpdateGlobal: "webpackHotUpdatewebpack",
sourcePrefix: undefined,
hashFunction: "md4",
hashDigest: "hex",
hashDigestLength: 20,
hashSalt: undefined,
workerChunkLoading: "import-scripts",
workerWasmLoading: "fetch",
},
module: {
rules: [
{
test: /\.jsx?$/,
include: [path.resolve(__dirname, "app")],
exclude: [path.resolve(__dirname, "app/demo-files")],
issuer: { or: [/\.css$/, path.resolve(__dirname, "app")] },
resource: /\.css$/,
compiler: /html-webpack-plugin/,
dependency: "esm",
dependency: "commonjs",
dependency: "amd",
dependency: "wasm",
dependency: "url",
dependency: "worker",
dependency: "loader",
descriptionData: {
type: "module",
},
mimetype: "text/javascript",
realResource: /\.css$/,
resourceFragment: "#blah",
resourceQuery: "?blah",
loader: "babel-loader",
options: {
presets: ["es2015"],
},
use: [
"htmllint-loader",
{
loader: "html-loader",
options: {},
},
],
type: "javascript/auto",
enforce: "pre",
generator: {
dataUrl: {
encoding: "base64",
mimetype: undefined,
},
filename: "",
},
parser: {
amd: false,
commonjs: false,
system: false,
harmony: false,
requireInclude: false,
requireEnsure: false,
requireContext: false,
browserify: false,
requireJs: false,
node: false,
node: {
},
worker: ["default from web-worker", "..."],
},
resolve: {
alias: {
key: "script.js",
},
fullySpecified: true,
},
sideEffects: false,
},
{
oneOf: [
],
},
{
rules: [
],
},
],
noParse: [/special-library\.js$/],
unknownContextRequest: ".",
unknownContextRecursive: true,
unknownContextRegExp: /^\.\/.*$/,
unknownContextCritical: true,
exprContextRequest: ".",
exprContextRegExp: /^\.\/.*$/,
exprContextRecursive: true,
exprContextCritical: true,
wrappedContextRegExp: /.*/,
wrappedContextRecursive: true,
wrappedContextCritical: false,
},
resolve: {
modules: ["node_modules"],
extensions: [".wasm", ".mjs", ".js", ".json"],
alias: {
module: "new-module",
"only-module$": "new-module",
module: path.resolve(__dirname, "app/third/module.js"),
module: path.resolve(__dirname, "app/third"),
[path.resolve(__dirname, "app/module.js")]: path.resolve(
__dirname,
"app/alternative-module.js",
),
},
conditionNames: ["webpack", "production", "browser"],
roots: [context],
fallback: { events: path.resolve(__dirname, "events.js") },
mainFields: ["main"],
restrictions: [/\.js$/, path.resolve(__dirname, "app")],
cache: false,
unsafeCache: false,
unsafeCache: {},
plugins: [
],
symlinks: true,
descriptionFiles: ["package.json"],
aliasFields: ["browser"],
exportsFields: ["exports"],
importsFields: ["imports"],
mainFiles: ["index"],
fullySpecified: true,
preferRelative: true,
enforceExtension: false,
cachePredicate: ({ path, request }) => true,
cacheWithContext: false,
useSyncFileSystemCalls: false,
byDependency: {},
},
performance: {
hints: "warning",
maxAssetSize: 250000,
maxEntrypointSize: 250000,
assetFilter: (assetFilename) => {
return !/\.map$/.test(assetFilename);
},
},
devtool: false,
context: __dirname,
target: "web",
externals: undefined,
externalsType: "var",
externalsPresets: {
electron: false,
electronMain: false,
electronPreload: false,
electronRenderer: false,
node: false,
nwjs: false,
web: true,
webAsync: true,
},
ignoreWarnings: undefined,
stats: "errors-only",
stats: {
preset: "errors-only",
all: false,
colors: true,
context: "../src/",
ids: true,
env: true,
outputPath: true,
publicPath: true,
assets: true,
assetsSort: "id",
assetsSpace: 15,
cachedAssets: true,
excludeAssets: false,
groupAssetsByPath: true,
groupAssetsByExtension: true,
groupAssetsByEmitStatus: true,
groupAssetsByChunk: true,
groupAssetsByInfo: true,
relatedAssets: true,
performance: true,
entrypoints: true,
chunkGroups: true,
chunkGroupAuxiliary: true,
chunkGroupChildren: true,
chunkGroupMaxAssets: 5,
chunks: true,
chunksSort: "id",
chunkModules: true,
chunkOrigins: true,
chunkRelations: true,
dependentModules: true,
modules: true,
modulesSpace: 15,
nestedModules: true,
cachedModules: true,
orphanModules: false,
excludeModules: false,
reasons: true,
source: false,
modulesSort: "id",
groupModulesByPath: true,
groupModulesByExtension: true,
groupModulesByAttributes: true,
groupModulesByCacheStatus: true,
depth: false,
moduleAssets: true,
runtimeModules: true,
providedExports: false,
usedExports: false,
optimizationBailout: false,
children: true,
logging: true,
loggingDebug: /webpack/,
loggingTrace: true,
warnings: true,
errors: true,
errorDetails: true,
errorStack: true,
moduleTrace: true,
builtAt: true,
errorsCount: true,
warningsCount: true,
timings: true,
version: true,
hash: true,
},
devServer: {
proxy: {
"/api": "http://localhost:3000",
},
contentBase: path.join(__dirname, "public"),
compress: true,
historyApiFallback: false,
hot: true,
https: false,
noInfo: true,
},
experiments: {
asyncWebAssembly: true,
syncWebAssembly: true,
outputModule: true,
topLevelAwait: true,
},
plugins: [
],
optimization: {
chunkIds: "deterministic",
moduleIds: "deterministic",
mangleExports: "deterministic",
minimize: true,
minimizer: [],
concatenateModules: true,
emitOnErrors: false,
flagIncludedChunks: true,
innerGraph: true,
mergeDuplicateChunks: true,
nodeEnv: "production",
portableRecords: false,
providedExports: true,
usedExports: true,
realContentHash: true,
removeAvailableModules: false,
removeEmptyChunks: true,
runtimeChunk: false,
sideEffects: true,
splitChunks: {
cacheGroups: {
"my-name": {
test: /\.sass$/,
type: "css/mini-extract",
chunks: "async",
minChunks: 1,
enforceSizeThreshold: 100000,
minSize: 0,
minRemainingSize: 0,
usedExports: true,
maxAsyncRequests: 30,
maxInitialRequests: 30,
maxAsyncSize: 200000,
maxInitialSize: 100000,
maxSize: 200000,
filename: "my-name-[contenthash].js",
idHint: "my-name",
name: false,
hidePathInfo: true,
automaticNameDelimiter: "-",
},
},
fallbackCacheGroup: {
automaticNameDelimiter: "-",
minSize: 20000,
maxAsyncSize: 200000,
maxInitialSize: 100000,
maxSize: 200000,
},
chunks: "all",
usedExports: true,
minChunks: 1,
enforceSizeThreshold: 50000,
minSize: 20000,
minRemainingSize: 20000,
maxAsyncRequests: 30,
maxInitialRequests: 30,
maxAsyncSize: 200000,
maxInitialSize: 100000,
maxSize: 200000,
filename: "[contenthash].js",
name: false,
hidePathInfo: true,
automaticNameDelimiter: "~",
defaultSizeTypes: ["javascript", "unknown"],
},
},
loader: {
},
resolveLoader: {
},
node: {
global: true,
__filename: "mock",
__dirname: "mock",
},
recordsPath: path.resolve(__dirname, "build/records.json"),
recordsInputPath: path.resolve(__dirname, "build/records.json"),
recordsOutputPath: path.resolve(__dirname, "build/records.json"),
cache: false,
cache: {
type: "filesystem",
cacheDirectory: "node_modules/.cache/webpack",
cacheLocation: path.resolve(cache.cacheDriectory, cache.name),
buildDependencies: {
defaultWebpack: ["webpack/lib"],
},
hashAlgorithm: "md4",
name: `${config.name}-${config.mode}`,
store: "pack",
version: "",
idleTimeout: 10000,
idleTimeoutForInitialStore: 0,
},
snapshot: {
managedPaths: [path.resolve(__dirname, "node_modules")],
immutablePaths: [],
module: {
timestamp: true,
hash: true,
},
resolve: {
timestamp: true,
hash: true,
},
resolveBuildDependencies: {
timestamp: true,
hash: true,
},
buildDependencies: {
timestamp: true,
hash: true,
},
},
watch: true,
watchOptions: {
aggregateTimeout: 200,
ignored: /node_modules/,
poll: false,
},
infrastructureLogging: {
level: "info",
debug: undefined,
},
parallelism: 100,
profile: true,
bail: false,
dependencies: ["name"],
};