fix: copy non-ugilified tiddlywiki source to the dist

This commit is contained in:
林一二 2021-06-02 22:02:55 +08:00
parent a646610d23
commit ee7cf2c5f7
3 changed files with 20 additions and 2 deletions

View file

@ -4,17 +4,27 @@ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const path = require('path');
const fs = require('fs-extra');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const ThreadsPlugin = require('threads-plugin');
const ExternalsPlugin = require('webpack5-externals-plugin');
const EventHooksPlugin = require('event-hooks-webpack-plugin');
exports.main = [
// we only need one instance of TsChecker, it will check main and renderer all together
new ForkTsCheckerWebpackPlugin(),
new CopyPlugin({
// to is relative to ./.webpack/main/
patterns: [{ from: 'localization', to: 'localization' }],
patterns: [
{ from: 'localization', to: 'localization' },
],
}),
new EventHooksPlugin({
'afterEmit': (compilation, done) => {
console.log('Copying tiddlywiki dependency to dist');
void fs.copy('node_modules/@tiddlygit/tiddlywiki', './.webpack/node_modules/@tiddlygit/tiddlywiki', done);
},
}),
new CircularDependencyPlugin({
// exclude detection of files based on a RegExp