1+ //@ts -check
2+ /** @typedef {import('webpack').Configuration } WebpackConfig **/
3+
4+ 'use strict' ;
5+
16var path = require ( "path" ) ;
27
38function resolve ( filePath ) {
@@ -13,48 +18,50 @@ var babelOptions = {
1318 plugins : [ "@babel/plugin-transform-runtime" ]
1419}
1520
16- module . exports = function ( env , argv ) {
21+ module . exports = function ( env , argv ) {
1722 var isProduction = argv . mode == "production"
1823 console . log ( "Bundling for " + ( isProduction ? "production" : "development" ) + "..." ) ;
1924
2025 var ionideExperimental = ( env && env . ionideExperimental ) ;
2126 var outputPath = ionideExperimental ? "release-exp" : "release" ;
2227 console . log ( "Output path: " + outputPath ) ;
2328
24- return {
25- target : 'node' ,
26- mode : isProduction ? "production" : "development" ,
27- devtool : "source-map" ,
28- entry : './out/fsharp.js' ,
29- output : {
30- filename : 'fsharp.js' ,
31- path : resolve ( './' + outputPath ) ,
32- //library: 'IONIDEFSHARP',
33- libraryTarget : 'commonjs2'
34- } ,
35- resolve : {
36- modules : [ resolve ( "./node_modules/" ) ]
37- } ,
38- //externals: [nodeExternals()],
39- externals : {
40- // Who came first the host or the plugin ?
41- "vscode" : "commonjs vscode" ,
42-
43- // Optional dependencies of ws
44- "utf-8-validate" : "commonjs utf-8-validate" ,
45- "bufferutil" : "commonjs bufferutil"
46- } ,
47- module : {
48- rules : [
49- {
50- test : / \. j s $ / ,
51- exclude : / n o d e _ m o d u l e s / ,
52- use : {
53- loader : 'babel-loader' ,
54- options : babelOptions
55- } ,
56- }
57- ]
58- }
59- } ;
29+ /**@type WebpackConfig*/
30+ const config = {
31+ target : 'node' ,
32+ mode : isProduction ? "production" : "development" ,
33+ devtool : "source-map" ,
34+ entry : './out/fsharp.js' ,
35+ output : {
36+ filename : 'fsharp.js' ,
37+ path : resolve ( './' + outputPath ) ,
38+ //library: 'IONIDEFSHARP',
39+ libraryTarget : 'commonjs2'
40+ } ,
41+ resolve : {
42+ modules : [ resolve ( "./node_modules/" ) ]
43+ } ,
44+ //externals: [nodeExternals()],
45+ externals : {
46+ // Who came first the host or the plugin ?
47+ "vscode" : "commonjs vscode" ,
48+
49+ // Optional dependencies of ws
50+ "utf-8-validate" : "commonjs utf-8-validate" ,
51+ "bufferutil" : "commonjs bufferutil"
52+ } ,
53+ module : {
54+ rules : [
55+ {
56+ test : / \. j s $ / ,
57+ exclude : / n o d e _ m o d u l e s / ,
58+ use : {
59+ loader : 'babel-loader' ,
60+ options : babelOptions
61+ } ,
62+ }
63+ ]
64+ }
65+ } ;
66+ return config ;
6067}
0 commit comments