2018-12-18 08:16:08 +03:00
/ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Copyright ( c ) Microsoft Corporation . All rights reserved .
* Licensed under the MIT License . See License . txt in the project root for license information .
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- * /
//@ts-check
'use strict' ;
const path = require ( 'path' ) ;
2020-11-23 04:55:31 +03:00
const CopyWebpackPlugin = require ( 'copy-webpack-plugin' ) ;
2018-12-18 08:16:08 +03:00
/**@type {import('webpack').Configuration}*/
const config = {
target : 'node' , // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
node : {
_ _dirname : false ,
_ _filename : false ,
} ,
2020-11-23 04:55:31 +03:00
entry : {
"extension.bundle" : "./extension.bundle.ts" ,
} , // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
2018-12-18 08:16:08 +03:00
output : { // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
path : path . resolve ( _ _dirname , 'dist' ) ,
2020-11-23 04:55:31 +03:00
filename : '[name].js' ,
2018-12-18 08:16:08 +03:00
libraryTarget : "commonjs2" ,
devtoolModuleFilenameTemplate : "../[resource-path]" ,
} ,
2020-11-23 04:55:31 +03:00
plugins : [
// Copy files to dist folder where the runtime can find them
2021-04-08 10:39:15 +03:00
// @ts-ignore
2020-11-23 04:55:31 +03:00
new CopyWebpackPlugin ( {
patterns : [
{
from : path . join ( _ _dirname , 'out' , 'test' ) ,
to : path . join ( _ _dirname , 'dist' , 'test' )
} ,
]
} ) ,
] ,
2018-12-18 08:16:08 +03:00
externals : {
vscode : "commonjs vscode" , // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
} ,
devtool : 'source-map' ,
resolve : { // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
extensions : [ '.ts' , '.js' ] ,
} ,
module : {
rules : [ {
test : /\.ts$/ ,
exclude : /node_modules/ ,
use : [ {
loader : 'ts-loader' ,
} ]
} ]
} ,
}
2020-01-13 05:24:30 +03:00
module . exports = config ;