vscode-appwrite/webpack.config.js

55 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

2021-04-19 21:11:56 +01:00
//@ts-check
'use strict';
2022-10-07 17:10:20 +01:00
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
2021-04-19 21:11:56 +01:00
const path = require('path');
2022-10-07 17:10:20 +01:00
const webpack = require('webpack');
2021-04-19 21:11:56 +01:00
/**@type {import('webpack').Configuration}*/
const config = {
2022-10-07 17:10:20 +01:00
node: {
__dirname: true
},
2021-04-19 21:11:56 +01:00
target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
output: {
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
path: path.resolve(__dirname, 'dist'),
filename: 'extension.js',
2022-10-07 17:10:20 +01:00
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../[resource-path]'
2021-04-19 21:11:56 +01:00
},
2022-10-07 17:10:20 +01:00
devtool: 'eval-source-map',
2021-04-19 21:11:56 +01: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/
},
resolve: {
2022-10-07 17:10:20 +01:00
// mainFields: ['browser', 'module', 'main'],
2021-04-19 21:11:56 +01:00
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
2022-10-07 17:10:20 +01:00
extensions: ['.ts', '.js'],
fallback: {
"fs": false
}
2021-04-19 21:11:56 +01:00
},
2022-10-07 17:10:20 +01:00
plugins: [
new NodePolyfillPlugin()
],
2021-04-19 21:11:56 +01:00
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
]
}
]
}
};
module.exports = config;