diff --git a/services/web/.gitignore b/services/web/.gitignore index f08e977e29..57ebc26c5a 100644 --- a/services/web/.gitignore +++ b/services/web/.gitignore @@ -49,6 +49,8 @@ TpdsWorker.js BackgroundJobsWorker.js UserAndProjectPopulator.coffee +public/es/modules + public/js/*.js public/js/*.map public/js/libs/sharejs.js diff --git a/services/web/app/views/project/editor.pug b/services/web/app/views/project/editor.pug index aac2cf1c0b..e4005a7e9c 100644 --- a/services/web/app/views/project/editor.pug +++ b/services/web/app/views/project/editor.pug @@ -161,7 +161,7 @@ block requirejs if hasFeature('rich-text') script( - src=buildWebpackPath('es/richText.js', {hashedPath:settings.useMinifiedJs}) + src=buildWebpackPath('es/rich-text.js', {hashedPath:settings.useMinifiedJs}) type="text/javascript" ) diff --git a/services/web/test/unit_frontend/coffee/ide/editor/directives/cmEditorTests.coffee b/services/web/test/unit_frontend/coffee/ide/editor/directives/cmEditorTests.coffee index a08e324375..ac89a63691 100644 --- a/services/web/test/unit_frontend/coffee/ide/editor/directives/cmEditorTests.coffee +++ b/services/web/test/unit_frontend/coffee/ide/editor/directives/cmEditorTests.coffee @@ -6,7 +6,7 @@ define ['ide/editor/directives/cmEditor'], () -> @richTextInit = sinon.stub() @richTextOpenDoc = sinon.stub() window.Frontend = { - richText: { + 'rich-text': { init: @richTextInit, openDoc: @richTextOpenDoc } diff --git a/services/web/webpack.config.js b/services/web/webpack.config.js index 369d5a2035..4fc924b489 100644 --- a/services/web/webpack.config.js +++ b/services/web/webpack.config.js @@ -1,11 +1,24 @@ +const fs = require('fs') const path = require('path') +const MODULES_PATH = path.join(__dirname, '/modules') + +// Generate a hash of entry points, including modules +const entryPoints = {} +if (fs.existsSync(MODULES_PATH)) { + fs.readdirSync(MODULES_PATH).reduce((acc, module) => { + const entryPath = path.join(MODULES_PATH, module, '/public/es/index.js') + if (fs.existsSync(entryPath)) { + acc[module] = entryPath + } + return acc + }, entryPoints) +} + module.exports = { // Defines the "entry point(s)" for the application - i.e. the file which // bootstraps the application - entry: { - richText: './public/es/rich-text.js' - }, + entry: entryPoints, // Define where and how the bundle will be output to disk // Note: webpack-dev-server does not write the bundle to disk, instead it is