mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-03 19:32:35 +02:00
feat: webpack config creator
This commit is contained in:
parent
10f85696d9
commit
b0f884e843
6 changed files with 73 additions and 98 deletions
32
lib/webpack/prod.js
Normal file
32
lib/webpack/prod.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
const path = require('path');
|
||||
const staticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin');
|
||||
const createBaseConfig = require('./base');
|
||||
|
||||
module.exports = function createProdConfig(props) {
|
||||
const config = createBaseConfig(props);
|
||||
|
||||
config.entry('main').add(path.resolve(__dirname, '../core/prodEntry.js'));
|
||||
config.output.libraryTarget('umd');
|
||||
|
||||
// Workaround for Webpack 4 Bug (https://github.com/webpack/webpack/issues/6522)
|
||||
config.output.globalObject('this');
|
||||
|
||||
const {siteConfig, docsData} = props;
|
||||
|
||||
// Find all available paths
|
||||
const paths = docsData.map(docs => docs.path);
|
||||
|
||||
config.plugin('StaticSiteGenerator').use(staticSiteGeneratorPlugin, [
|
||||
{
|
||||
entry: 'main',
|
||||
locals: {
|
||||
bundlejs: 'bundle.js',
|
||||
title: siteConfig.title || 'Munseo',
|
||||
lang: 'en'
|
||||
},
|
||||
paths
|
||||
}
|
||||
]);
|
||||
|
||||
return config;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue