Skip to content

Commit

Permalink
Added build config from @Juice10/record-once-rrweb
Browse files Browse the repository at this point in the history
  • Loading branch information
joris committed Oct 2, 2020
1 parent 0159fa1 commit 92ca08b
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package-lock.json
yarn.lock
build
dist
dist-electron
es
lib

Expand Down
19 changes: 16 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@
"test:watch": "PUPPETEER_HEADLESS=true npm run test -- --watch --watch-extensions js,ts",
"repl": "npm run bundle:browser && cross-env TS_NODE_CACHE=false TS_NODE_FILES=true ts-node scripts/repl.ts",
"bundle:browser": "cross-env BROWSER_ONLY=true rollup --config",
"bundle": "rollup --config",
"typings": "tsc -d --declarationDir typings"
"bundle:inject": "npx webpack --config webpack.config-inject.js",
"bundle:default": "rollup --config",
"bundle": "run-s bundle:inject bundle:default",
"dev": "run-p dev:**",
"dev:default": "rollup --watch --config",
"dev:inject": "npx webpack --watch --config webpack.config-inject.js",
"typings": "tsc -d --declarationDir typings",
"start:client": "webpack-dev-server --config webpack.config.js",
"start": "babel-watch ./scrubber/server.js"
},
"repository": {
"type": "git",
Expand All @@ -24,6 +31,7 @@
"typings": "typings/entries/all.d.ts",
"files": [
"dist",
"dist-electron",
"lib",
"es",
"typings"
Expand All @@ -45,6 +53,7 @@
"inquirer": "^6.2.1",
"jest-snapshot": "^23.6.0",
"mocha": "^5.2.0",
"npm-run-all": "^4.1.5",
"puppeteer": "^1.11.0",
"rollup": "^2.3.3",
"rollup-plugin-commonjs": "^9.2.0",
Expand All @@ -55,7 +64,11 @@
"ts-node": "^7.0.1",
"tslib": "^1.9.3",
"tslint": "^4.5.1",
"typescript": "^3.9.5"
"typescript": "^3.9.5",
"webpack-cli": "^3.3.12",
"webpack-dev-middleware": "^3.7.2",
"webpack-dev-server": "^3.11.0",
"webpack-hot-middleware": "^2.25.0"
},
"dependencies": {
"@types/css-font-loading-module": "0.0.4",
Expand Down
62 changes: 62 additions & 0 deletions webpack.config-inject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const path = require('path');

module.exports = {
mode: 'development',
entry: {
app: ['./src/electron-inject'],
},
output: {
path: path.resolve(__dirname, 'dist-electron'),
filename: 'index.js',
},
target: 'electron-preload',
resolve: {
extensions: ['.tsx', '.ts', '.js', '.mjs'],

alias: {
'rrweb/record$': path.resolve(__dirname, 'src/record/index.ts'),
rrweb$: path.resolve(__dirname, 'src/index.ts'),
},
},
module: {

rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
{
test: /scrubber\/scripts\.js$/,
exclude: /(node_modules|bower_components)/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
modules: 'auto', // commonjs,amd,umd,systemjs,false
useBuiltIns: 'usage',
targets: '> 0.25%, not dead',
corejs: 3,
},
],
],
},
},
],
},
],
},
};

0 comments on commit 92ca08b

Please sign in to comment.