chore: fix clipper CI failing

This commit is contained in:
Aman Harwara
2023-07-12 19:42:45 +05:30
parent e4b858f2e8
commit af3eafb009
31 changed files with 275 additions and 39 deletions

View File

@@ -0,0 +1,23 @@
module.exports = ({ htmlWebpackPlugin }) => {
return `<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
<meta content="viewport-fit=cover, width=device-width, initial-scale=1" name="viewport" />
<meta name="theme-color" content="#ffffff" />
<title>Standard Notes</title>
<script src="./globals.js"></script>
${htmlWebpackPlugin.tags.headTags}
<style>
html,
body {
min-width: 350px;
max-width: 350px;
min-height: 260px;
}
</style>
</head>
<body></body>
</html>`
}

View File

@@ -72,6 +72,7 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.6.0",
"html-webpack-plugin": "^5.5.3",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",

View File

@@ -4,6 +4,8 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CircularDependencyPlugin = require('circular-dependency-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const mergeWithEnvDefaults = require('./web.webpack-defaults')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const clipperHtmlTemplate = require('./clipper.htmlTemplate')
require('dotenv').config()
module.exports = (env) => {
@@ -28,8 +30,16 @@ module.exports = (env) => {
return {
entry: './src/javascripts/index.ts',
output: {
filename: './app.js',
filename: process.env.BUILD_TARGET === 'clipper' ? './[name].bundle.js' : './app.js',
},
optimization:
process.env.BUILD_TARGET === 'clipper'
? {
splitChunks: {
chunks: 'all',
},
}
: undefined,
plugins: [
new CircularDependencyPlugin({
// exclude detection of files based on a RegExp
@@ -55,6 +65,12 @@ module.exports = (env) => {
new CopyWebpackPlugin({
patterns: copyPluginPatterns,
}),
process.env.BUILD_TARGET === 'clipper' &&
new HtmlWebpackPlugin({
filename: 'popup.html',
inject: false,
templateContent: clipperHtmlTemplate,
}),
],
resolve: {
extensions: ['.ts', '.tsx', '.js'],