mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
54 lines
1.5 KiB
JavaScript
54 lines
1.5 KiB
JavaScript
|
const path = require('path')
|
||
|
|
||
|
module.exports = {
|
||
|
// Defines the "entry point" for the application - i.e. the file which
|
||
|
// bootstraps the application
|
||
|
entry: {
|
||
|
'rich-text': './public/frontend/rich-text.js'
|
||
|
},
|
||
|
|
||
|
// 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
|
||
|
// kept in memory for speed
|
||
|
output: {
|
||
|
path: path.join(__dirname, '/public/js/frontend'),
|
||
|
// publicPath: '/frontend/',
|
||
|
|
||
|
filename: '[name].js',
|
||
|
|
||
|
// Output as UMD bundle (allows main JS to import with CJS, AMD or global
|
||
|
// style code bundles
|
||
|
libraryTarget: 'umd',
|
||
|
// Name the exported variable from output bundle
|
||
|
library: ['Frontend', '[name]']
|
||
|
},
|
||
|
|
||
|
// TODO??
|
||
|
// Defines the external modules which will be stripped out when bundling for
|
||
|
// the rails app. These modules are already loaded in the rails app
|
||
|
// environment, so we strip them out to prevent conflicts.
|
||
|
// externals: {},
|
||
|
|
||
|
// Define how file types are handled by webpack
|
||
|
module: {
|
||
|
rules: [{
|
||
|
// Pass application JS files through babel-loader, compiling to ES5
|
||
|
test: /\.js$/, // Only compile .js files
|
||
|
// Only compile application files (dependencies are in ES5 already)
|
||
|
// include: [path.join(__dirname, './public/frontend')],
|
||
|
exclude: /node_modules/,
|
||
|
use: [{
|
||
|
loader: 'babel-loader',
|
||
|
options: {
|
||
|
presets: ['env'],
|
||
|
// Configure babel-loader to cache compiled output so that subsequent
|
||
|
// compile runs are much faster
|
||
|
cacheDirectory: true
|
||
|
}
|
||
|
}]
|
||
|
}]
|
||
|
},
|
||
|
|
||
|
// TODO
|
||
|
// plugins: {}
|
||
|
}
|