1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-03 23:50:33 +02:00

Plugin Repo: Add support for source maps

This commit is contained in:
Laurent Cozic
2021-12-22 11:28:05 +01:00
parent 780f2ea12b
commit bc9dac2feb
5 changed files with 48 additions and 2 deletions

View File

@ -3,10 +3,19 @@ const webpack = require('webpack');
const distDir = path.resolve(__dirname, 'dist');
// To get source maps working:
//
// - Need to add `require('source-map-support').install()` on top of index.ts
// - Set `devtool: 'source-map'`
// - It only works in development mode
// - Need to add the "source-map-loader" rule so that it uses the maps generated
// by TypeScript
module.exports = {
entry: './index.js',
mode: 'production',
mode: 'development',
target: 'node',
devtool: 'source-map',
output: {
filename: 'index.js',
path: distDir,
@ -17,4 +26,13 @@ module.exports = {
raw: true,
}),
],
module: {
rules: [
{
test: /\.js$/,
enforce: 'pre',
use: ['source-map-loader'],
},
],
},
};