Skip to content

Commit c510077

Browse files
author
tohosaku
committed
Unify the format of the module to umd.
UMD supports both AMD and commonjs2. so we don't see the need to create two modules.
1 parent 5d6c41c commit c510077

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

config/webpack.dev.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ module.exports = webpackMerge(commonConfig, {
1010
path: helpers.root('dist/dev'),
1111
publicPath: '/dist/',
1212
filename: '[name].js',
13-
chunkFilename: '[id].chunk.js'
13+
chunkFilename: '[id].chunk.js',
14+
libraryTarget: 'umd'
1415
},
1516

1617
devServer: {

config/webpack.nonmin.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ module.exports = webpackMerge(commonConfig, {
1111
path: helpers.root('dist/nonmin'),
1212
publicPath: '/dist/',
1313
filename: '[name].js',
14-
chunkFilename: '[id].chunk.js'
14+
chunkFilename: '[id].chunk.js',
15+
libraryTarget: 'umd'
1516
},
1617

1718
plugins: [

config/webpack.prod.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const helpers = require('./helpers')
66

77
const ENV = (process.env.NODE_ENV = process.env.ENV = 'production')
88

9-
function createConfig (target) {
10-
filenameInsert = target === 'var' ? '.' : '.' + target + '.'
9+
function createConfig () {
1110
commonConfig.module.rules = [
1211
{
1312
enforce: 'pre',
@@ -39,9 +38,9 @@ function createConfig (target) {
3938
output: {
4039
path: helpers.root('dist'),
4140
publicPath: '/dist/',
42-
filename: '[name]' + filenameInsert + 'js',
43-
chunkFilename: '[id]' + filenameInsert + 'chunk.js',
44-
libraryTarget: target
41+
filename: '[name].js',
42+
chunkFilename: '[id].chunk.js',
43+
libraryTarget: 'umd'
4544
},
4645

4746
optimization: {
@@ -69,7 +68,5 @@ function createConfig (target) {
6968
}
7069

7170
module.exports = [
72-
createConfig('var'),
73-
createConfig('amd'),
74-
createConfig('commonjs2')
71+
createConfig()
7572
]

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"description": "JSON Schema based editor",
55
"version": "2.2.0",
66
"main": "dist/jsoneditor.js",
7-
"module": "dist/jsoneditor.commonjs2.js",
87
"author": {
98
"name": "Jeremy Dorn",
109
"email": "jeremy@jeremydorn.com",

src/core.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,5 +396,3 @@ Object.assign(JSONEditor.defaults.themes, themes)
396396
Object.assign(JSONEditor.defaults.editors, editors)
397397
Object.assign(JSONEditor.defaults.templates, templates)
398398
Object.assign(JSONEditor.defaults.iconlibs, iconlibs)
399-
400-
window.JSONEditor = JSONEditor

0 commit comments

Comments
 (0)