diff --git a/Gruntfile.js b/Gruntfile.js index e9590b1e44..3416d2ae32 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -48,7 +48,9 @@ module.exports = function (grunt) { dirs: dirs, pkgVersion: grunt.file.readJSON('package.json').version, webpack: { - config: webpackConfig + all: Object.values(webpackConfig), + node: webpackConfig.node, + browser: [webpackConfig.browser, webpackConfig.browserMin] } }; @@ -110,7 +112,17 @@ module.exports = function (grunt) { grunt.registerTask('build', [ 'checkGitSubmodules', - 'webpack' + 'webpack:all' + ]); + + grunt.registerTask('build:node', [ + 'checkGitSubmodules', + 'webpack:node' + ]); + + grunt.registerTask('build:browser', [ + 'checkGitSubmodules', + 'webpack:browser' ]); grunt.registerTask('check-closure-compiler', [ @@ -126,12 +138,12 @@ module.exports = function (grunt) { grunt.registerTask('test', ['test:node']); grunt.registerTask('test:node', 'Build the library and run the node test suite\nOptions\n --test [tests] e.g. --test test/rest/auth.js', - ['build', 'mocha'] + ['build:node', 'mocha'] ); grunt.registerTask('test:webserver', 'Launch the Mocha test web server on http://localhost:3000/', - ['build', 'checkGitSubmodules', 'mocha:webserver'] + ['build:browser', 'checkGitSubmodules', 'mocha:webserver'] ); grunt.registerTask('release:refresh-pkgVersion', diff --git a/package.json b/package.json index 8abedb1506..d38c5b886f 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,9 @@ "test:webserver": "grunt test:webserver", "test:playwright": "node spec/support/runPlaywrightTests.js", "concat": "grunt concat", - "build": "grunt build", + "build": "grunt build:all", + "build:node": "grunt build:node", + "build:browser": "grunt build:browser", "requirejs": "grunt requirejs", "lint": "eslint nodejs/**/*.js common/**/*.js browser/lib/**/*.js", "lint:fix": "eslint --fix nodejs/**/*.js common/**/*.js browser/lib/**/*.js", diff --git a/webpack.config.js b/webpack.config.js index fb035754e8..ca894a2c7c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -282,15 +282,15 @@ const commonJsNoEncryptionConfig = { }, }; -module.exports = [ - nodeConfig, - browserConfig, - browserMinConfig, - webworkerConfig, - nativeScriptConfig, - reactNativeConfig, - noEncryptionConfig, - noEncryptionMinConfig, - commonJsConfig, - commonJsNoEncryptionConfig, -]; +module.exports = { + node: nodeConfig, + browser: browserConfig, + browserMin: browserMinConfig, + webworker: webworkerConfig, + nativeScript: nativeScriptConfig, + reactNative: reactNativeConfig, + noEncryption: noEncryptionConfig, + noEncryptionMin: noEncryptionMinConfig, + commonJs: commonJsConfig, + commonJsNoEncryption: commonJsNoEncryptionConfig, +};