npm package diff
Package: @forge/bundler
Versions: 4.20.1-next.6 - 4.20.1-next.7
File: package/out/config/common.js
Index: package/out/config/common.js
===================================================================
--- package/out/config/common.js
+++ package/out/config/common.js
@@ -23,13 +23,13 @@
function resolveStubPath(stubName) {
return (0, exports.resolveModulePath)(`../stubs/${stubName}`);
}
exports.resolveStubPath = resolveStubPath;
-const getDevToolConfig = (config) => {
- if (!config.isWatchMode) {
+const getDevToolConfig = ({ watchMode }) => {
+ if (!watchMode) {
return 'source-map';
}
- return config.isDebugMode ? 'inline-source-map' : 'cheap-source-map';
+ return watchMode === 'debug' ? 'inline-source-map' : 'cheap-source-map';
};
exports.getDevToolConfig = getDevToolConfig;
const geti18nRule = (i18nConfig) => {
const i18nResources = i18nConfig.resources || [];
@@ -47,28 +47,30 @@
}
};
};
exports.geti18nRule = geti18nRule;
-const getCommonWebpackConfig = (entrypoints, config) => {
+const getCommonWebpackConfig = (args) => {
if (!require.main) {
throw new Error(text_1.Text.noExecutableFile);
}
+ const { entryPoints, appDirectory } = args;
const resolvedEntryPoints = {};
- for (const entrypoint of entrypoints) {
+ for (const entrypoint of entryPoints) {
resolvedEntryPoints[entrypoint.name] = path_1.default.resolve(entrypoint.path);
}
+ const outputDir = args.watchMode === 'debug' ? path_1.default.resolve(cli_shared_1.TUNNEL_BUNDLE_DIRECTORY) : (0, cli_shared_1.tmpDir)('dist');
return {
entry: resolvedEntryPoints,
mode: 'production',
optimization: {
minimize: false
},
- devtool: (0, exports.getDevToolConfig)(config),
+ devtool: (0, exports.getDevToolConfig)(args),
output: {
libraryTarget: 'commonjs',
globalObject: 'this',
filename: '[name].js',
- path: config.outputDir
+ path: outputDir
},
node: {
__dirname: true
},
@@ -132,10 +134,10 @@
jsx: 'react',
jsxFactory: 'ForgeUI.createElement',
sourceMap: true
},
- configFile: new tsconfig_interactor_1.TSConfigInteractor(new cli_shared_1.FileSystemReader(), config.appDirectory).getTSConfigPath(),
- context: config.appDirectory,
+ configFile: new tsconfig_interactor_1.TSConfigInteractor(new cli_shared_1.FileSystemReader(), appDirectory).getTSConfigPath(),
+ context: appDirectory,
onlyCompileBundledFiles: true
}
}
]