Skip to content

Commit

Permalink
Added CleanWebpackPlugin
Browse files Browse the repository at this point in the history
The webpack CleanWebpackPlugin removes all files from the dist folder before each build. This is required to make sure that there are no unnecessary files in the dist folder.
  • Loading branch information
PKief committed Mar 14, 2019
1 parent ae80b97 commit 41d7125
Show file tree
Hide file tree
Showing 2 changed files with 149 additions and 20 deletions.
150 changes: 139 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
//@ts-check

'use strict';

const CleanWebpackPlugin = require('clean-webpack-plugin');
const path = require('path');

/**@type {import('webpack').Configuration}*/
const config = {
target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
target: 'node',

entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
entry: './src/extension.ts',
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',
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../[resource-path]'
},
devtool: 'source-map',
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/
vscode: 'commonjs vscode'
},
resolve: {
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
extensions: ['.ts', '.js']
},
module: {
Expand All @@ -39,6 +36,10 @@ const config = {
}]
}
]
}
},
plugins: [
new CleanWebpackPlugin(),
]
};
module.exports = config;

module.exports = config;

0 comments on commit 41d7125

Please sign in to comment.