@@ -34,6 +34,10 @@ const config = {
3434 new CheckEsVersionPlugin ( {
3535 esVersion : 5 , // for IE11 support
3636 } ) ,
37+ new webpack . DefinePlugin ( {
38+ "process.env.WASM" : JSON . stringify ( null ) , // use only MSGPACK_WASM
39+ "process.env.TEXT_ENCODING" : JSON . stringify ( "null" ) ,
40+ } ) ,
3741 ] ,
3842 externals : {
3943 "base64-js" : {
@@ -55,14 +59,26 @@ const config = {
5559} ;
5660
5761export default [
62+ // default minified bundle does not includes wasm
63+ ( ( config ) => {
64+ config . output . filename = "msgpack.min.js" ;
65+ config . plugins . push (
66+ new webpack . DefinePlugin ( {
67+ "process.env.MSGPACK_WASM" : JSON . stringify ( "never" ) ,
68+ } ) ,
69+ new webpack . IgnorePlugin ( / \. \/ d i s t \/ w a s m \/ m s g p a c k \. w a s m \. j s $ / ) ,
70+ ) ;
71+ config . optimization . minimize = true ;
72+ return config ;
73+ } ) ( _ . cloneDeep ( config ) ) ,
74+
5875 // default bundle does not includes wasm
5976 ( ( config ) => {
6077 config . output . filename = "msgpack.js" ;
6178 config . plugins . push (
6279 new webpack . DefinePlugin ( {
6380 // The default bundle does not includes WASM
6481 "process.env.MSGPACK_WASM" : JSON . stringify ( "never" ) ,
65- "process.env.WASM" : JSON . stringify ( null ) ,
6682 } ) ,
6783 new webpack . IgnorePlugin ( / \. \/ d i s t \/ w a s m \/ m s g p a c k \. w a s m \. j s $ / ) ,
6884 ) ;
@@ -74,9 +90,7 @@ export default [
7490 config . output . filename = "msgpack+wasm.js" ;
7591 config . plugins . push (
7692 new webpack . DefinePlugin ( {
77- // The default bundle does not includes WASM
7893 "process.env.MSGPACK_WASM" : JSON . stringify ( null ) ,
79- "process.env.WASM" : JSON . stringify ( null ) ,
8094 } ) ,
8195 ) ;
8296 return config ;
0 commit comments