Skip to content

Commit

Permalink
fix: add file checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ampersarnie committed Jul 14, 2023
1 parent 2fdf436 commit a430cf5
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/commands/build.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const { terminal } = require('terminal-kit');
Expand Down Expand Up @@ -103,27 +104,21 @@ exports.handler = async ({

const configMap = packages.map((packageObject) => {
const projectPath = path.resolve(packageObject.path);
const customConfig = require(projectPath + '/webpack.config.js');
const customWebpackConfigFile = projectPath + '/webpack.config.js';
const customConfig = fs.existsSync(customWebpackConfigFile) ? require(customWebpackConfigFile) : {};

let customWebpackConfig = {}
let defaultWebpackConfig = {
let customWebpackConfig = {
extends: true,
externals: {
moment: 'moment',
lodash: ['lodash', 'lodash-es'],
react: 'React',
'react-dom': 'ReactDOM',
jquery: 'jQuery',
}
},
...customConfig,
};

try {
customWebpackConfig = {
...defaultWebpackConfig,
...customConfig,
};
} catch (e) {}

/**
* Project config holds all information about a particular project,
* rather than directly pulling out paths from files or attempting
Expand Down

0 comments on commit a430cf5

Please sign in to comment.