added webpack

This commit is contained in:
Danny Coates 2017-08-06 19:32:07 -07:00
parent c91d24cd86
commit 9172af48fd
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
5 changed files with 2748 additions and 48 deletions

View File

@ -1,7 +1,7 @@
let links = [];
document.addEventListener('DOMContentLoaded', function() {
links = document.querySelectorAll('a:not([target])');
links = Array.from(document.querySelectorAll('a:not([target])'));
});
function setOpenInNewTab(bool) {

View File

@ -1,4 +1,4 @@
const testPilotGA = require('testpilot-ga');
const testPilotGA = require('testpilot-ga/src/TestPilotGA');
const Storage = require('./storage');
const storage = new Storage(localStorage);
@ -196,7 +196,7 @@ function exitEvent(target) {
}
function addExitHandlers() {
const links = document.querySelectorAll('a');
const links = Array.from(document.querySelectorAll('a'));
links.forEach(l => {
if (/^http/.test(l.href)) {
l.addEventListener('click', exitEvent);
@ -212,7 +212,7 @@ function restartEvent(state) {
}
function addRestartHandlers() {
const elements = document.querySelectorAll('.send-new');
const elements = Array.from(document.querySelectorAll('.send-new'));
elements.forEach(el => {
const state = el.getAttribute('data-state');
el.addEventListener('click', restartEvent.bind(null, state));

2754
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,12 @@
},
"devDependencies": {
"asmcrypto.js": "0.0.11",
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"browserify": "^14.4.0",
"eslint": "^4.3.0",
"eslint-plugin-mocha": "^4.11.0",
@ -38,8 +43,8 @@
"stylelint-config-standard": "^17.0.0",
"supertest": "^3.0.0",
"testpilot-ga": "^0.3.0",
"uglifyify": "^4.0.3",
"webcrypto-liner": "^0.1.25"
"webcrypto-liner": "^0.1.25",
"webpack": "^3.4.1"
},
"engines": {
"node": ">=8.0.0"
@ -85,8 +90,7 @@
],
"scripts": {
"build": "npm-run-all build:*",
"build:upload": "browserify frontend/src/upload.js -g uglifyify -o public/upload.js",
"build:download": "browserify frontend/src/download.js -g uglifyify -o public/download.js",
"build:js": "webpack -p",
"build:version": "node scripts/version",
"build:vendor": "cp node_modules/l20n/dist/web/l20n.min.js node_modules/babel-polyfill/dist/polyfill.min.js public",
"contributors": "git shortlog -s -n | awk -F\\t '{print $2}' > CONTRIBUTORS",

22
webpack.config.js Normal file
View File

@ -0,0 +1,22 @@
const path = require('path');
module.exports = {
entry: {
upload: ['./frontend/src/upload.js'],
download: ['./frontend/src/download.js']
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'public')
},
module: {
loaders: [
{
test: /\.js$/,
loaders: 'babel-loader',
include: [path.resolve(__dirname, 'frontend'), path.resolve(__dirname, 'node_modules/testpilot-ga/src')],
query: { babelrc: false, presets: ['es2015', 'stage-2'], plugins: ['add-module-exports'] }
}
]
}
};