Skip to content

Commit

Permalink
cache option 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Gkrumbach07 committed Jul 18, 2024
1 parent b47bc73 commit 186291d
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 10,530 deletions.
18 changes: 17 additions & 1 deletion frontend/config/webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const { setupWebpackDotenvFilesForEnv } = require('./dotenv');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const { setupWebpackDotenvFilesForEnv } = require('./dotenv');

const RELATIVE_DIRNAME = process.env._ODH_RELATIVE_DIRNAME;
const IS_PROJECT_ROOT_DIR = process.env._ODH_IS_PROJECT_ROOT_DIR;
Expand All @@ -29,6 +29,7 @@ module.exports = (env) => {
return {
entry: {
app: path.join(SRC_DIR, 'index.tsx'),
serviceWorker: path.join(SRC_DIR, 'service-worker.ts'),
},
module: {
rules: [
Expand Down Expand Up @@ -222,6 +223,21 @@ module.exports = (env) => {
to: path.join(DIST_DIR),
noErrorOnMissing: true,
},
{
from: path.join(SRC_DIR, 'service-worker.ts'),
to: path.join(DIST_DIR, 'service-worker.js'),
transform(content) {
// Transpile TypeScript to JavaScript
const ts = require('typescript');
const result = ts.transpileModule(content.toString(), {
compilerOptions: {
module: ts.ModuleKind.CommonJS,
target: ts.ScriptTarget.ES5,
},
});
return result.outputText;
},
},
],
}),
new MonacoWebpackPlugin({
Expand Down
Loading

0 comments on commit 186291d

Please sign in to comment.