rhansen-webpack
Richard Hansen 2021-08-14 00:20:04 -04:00
parent cb50156fe0
commit 91b22030e2
2 changed files with 12 additions and 0 deletions

View File

@ -110,6 +110,11 @@ exports.expressCreateServer = async (hookName, args) => {
path: path.join(settings.root, 'var/js'), path: path.join(settings.root, 'var/js'),
filename: '[name]-[contenthash].js', filename: '[name]-[contenthash].js',
}, },
resolve: {
alias: {
'ep_etherpad-lite': path.join(settings.root, 'src'),
},
},
}); });
const stats = await util.promisify(compiler.run.bind(compiler))(); const stats = await util.promisify(compiler.run.bind(compiler))();
console.log(`webpack stats:\n${stats}`); console.log(`webpack stats:\n${stats}`);

View File

@ -6,6 +6,13 @@
// sends the CLIENT_VARS message. // sends the CLIENT_VARS message.
randomVersionString: <%-JSON.stringify(settings.randomVersionString)%>, randomVersionString: <%-JSON.stringify(settings.randomVersionString)%>,
}; };
// Allow other frames to access this frame's modules.
window.require = __webpack_require__;
window.require.resolve = __webpack_require__.resolve;
window.require.cache = __webpack_module_cache__;
window.require.resolveTmp = require.resolve('ep_etherpad-lite/static/js/pad_cookie');
const basePath = new URL('..', window.location.href).pathname; const basePath = new URL('..', window.location.href).pathname;
window.$ = window.jQuery = require('../../src/static/js/rjquery').jQuery; window.$ = window.jQuery = require('../../src/static/js/rjquery').jQuery;
window.browser = require('../../src/static/js/vendors/browser'); window.browser = require('../../src/static/js/vendors/browser');