mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Generate webpack entry points including modules
This commit is contained in:
parent
fe65137c05
commit
74099440f3
4 changed files with 20 additions and 5 deletions
2
services/web/.gitignore
vendored
2
services/web/.gitignore
vendored
|
@ -49,6 +49,8 @@ TpdsWorker.js
|
|||
BackgroundJobsWorker.js
|
||||
UserAndProjectPopulator.coffee
|
||||
|
||||
public/es/modules
|
||||
|
||||
public/js/*.js
|
||||
public/js/*.map
|
||||
public/js/libs/sharejs.js
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ define ['ide/editor/directives/cmEditor'], () ->
|
|||
@richTextInit = sinon.stub()
|
||||
@richTextOpenDoc = sinon.stub()
|
||||
window.Frontend = {
|
||||
richText: {
|
||||
'rich-text': {
|
||||
init: @richTextInit,
|
||||
openDoc: @richTextOpenDoc
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue