Skip to content

Commit

Permalink
refactor: 💡 rafact code
Browse files Browse the repository at this point in the history
  • Loading branch information
maoxiaoke committed Jun 16, 2021
1 parent bfcce16 commit dd7e2b4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/plugin-icestark/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ const plugin: IPlugin = async ({ onGetWebpackConfig, getValue, applyMethod, cont
/**
* For no need to change if souceMap type is inline、hidden or eval.
*/
const devtool = String(config.toConfig().devtool);
const devtool = config.get('devtool');
const inlineOrHiddenSourceMap = ['inline', 'eval', 'hidden'].some(type => devtool.includes(type));

if (!inlineOrHiddenSourceMap) {
const { devtoolFallbackModuleFilenameTemplate, devtoolNamespace } = config.toConfig().output;
const devtoolFallbackModuleFilenameTemplate = config.output.get('devtoolFallbackModuleFilenameTemplate');
const devtoolNamespace = config.output.get('devtoolNamespace');
const cheap = devtool.includes('cheap');
const moduleMaps = devtool.includes('module');
const noSources = devtool.includes('nosources');

const publicPath = isDev ? userConfig.devPublicPath : config.output.get('publicPath') ?? '/';
const publicPath = isDev ? userConfig.devPublicPath : config.output.get('publicPath') ?? '/';
const port = commandArgs.port;
const isHttps = commandArgs?.https;
const servePath = publicPath === '/' ? `http${isHttps ? 's' : ''}://localhost:${port}` : publicPath;
Expand Down

0 comments on commit dd7e2b4

Please sign in to comment.