From 3a752fde5117e800d65e26cbe7b15d65eb5b491e Mon Sep 17 00:00:00 2001 From: Literallie Date: Thu, 2 Nov 2017 17:57:44 +0100 Subject: [PATCH] Revert "Load js-url lib using legacy-loader" Didn't work in Firefox for some reason. `[Script Loader] ReferenceError: module is not defined` This reverts commit 5b83deb043296c23ff912a2472703c1f7faddb4b. --- package.json | 1 - public/js/history.js | 6 ++---- public/js/index.js | 6 ++---- webpackBaseConfig.js | 10 +++------- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 0d9f5019..35fe4f9c 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,6 @@ "js-yaml": "^3.7.0", "jsdom-nogyp": "^0.8.3", "keymaster": "^1.6.2", - "legacy-loader": "0.0.2", "list.js": "^1.5.0", "lodash": "^4.17.4", "lz-string": "1.4.4", diff --git a/public/js/history.js b/public/js/history.js index da82fd04..e14b80d8 100644 --- a/public/js/history.js +++ b/public/js/history.js @@ -12,16 +12,14 @@ import { urlpath } from './lib/config' -var jsUrl = require('js-url') - window.migrateHistoryFromTempCallback = null migrateHistoryFromTemp() function migrateHistoryFromTemp () { - if (jsUrl('#tempid')) { + if (window.url('#tempid')) { $.get(`${serverurl}/temp`, { - tempid: jsUrl('#tempid') + tempid: window.url('#tempid') }) .done(data => { if (data && data.temp) { diff --git a/public/js/index.js b/public/js/index.js index 56522e9c..b336af90 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -21,8 +21,6 @@ import _ from 'lodash' import List from 'list.js' -var jsUrl = require('js-url') - import { checkLoginStateChanged, setloginStateChangeEvent @@ -1476,12 +1474,12 @@ $('#gistImportModalConfirm').click(function () { if (!isValidURL(gisturl)) { showMessageModal(' Import from Gist', 'Not a valid URL :(', '', '', false) } else { - var hostname = jsUrl('hostname', gisturl) + var hostname = window.url('hostname', gisturl) if (hostname !== 'gist.github.com') { showMessageModal(' Import from Gist', 'Not a valid Gist URL :(', '', '', false) } else { ui.spinner.show() - $.get('https://api.github.com/gists/' + jsUrl('-1', gisturl)) + $.get('https://api.github.com/gists/' + window.url('-1', gisturl)) .done(function (data) { if (data.files) { var contents = '' diff --git a/webpackBaseConfig.js b/webpackBaseConfig.js index 71a8f2ef..41a63e7d 100644 --- a/webpackBaseConfig.js +++ b/webpackBaseConfig.js @@ -190,7 +190,7 @@ module.exports = { index: [ 'babel-polyfill', 'script!jquery-ui-resizable', - 'js-url', + 'script!js-url', 'expose?filterXSS!xss', 'script!Idle.Js', 'expose?LZString!lz-string', @@ -241,7 +241,7 @@ module.exports = { 'expose?jsyaml!js-yaml', 'script!mermaid', 'expose?moment!moment', - 'js-url', + 'script!js-url', 'script!handlebars', 'expose?hljs!highlight.js', 'expose?emojify!emojify.js', @@ -374,8 +374,7 @@ module.exports = { 'bootstrap-tooltip': path.join(__dirname, 'public/vendor/bootstrap/tooltip.min.js'), 'headjs': path.join(__dirname, 'node_modules/reveal.js/lib/js/head.min.js'), 'reveal-markdown': path.join(__dirname, 'public/js/reveal-markdown.js'), - abcjs: path.join(__dirname, 'public/vendor/abcjs_basic_3.1.1-min.js'), - 'js-url': path.join(__dirname, 'node_modules/js-url/url.js') + abcjs: path.join(__dirname, 'public/vendor/abcjs_basic_3.1.1-min.js') } }, @@ -430,9 +429,6 @@ module.exports = { }, { test: /\.gif(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=image/gif' - }, { - test: /\/node_modules\/js-url\/url.js/, - loader: 'legacy' }] }, node: {