mirror of
https://github.com/noodlapp/noodl.git
synced 2026-01-12 15:22:52 +01:00
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com> Co-Authored-By: Johan <4934465+joolsus@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
//shared config for regular (non-deploy) viewer
|
|
|
|
const path = require('path');
|
|
const { merge } = require('webpack-merge');
|
|
const { outPath, runtimeVersion } = require('./constants.js');
|
|
const common = require('./webpack.common.js');
|
|
const webpack = require('webpack');
|
|
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
const GenerateJsonPlugin = require('generate-json-webpack-plugin');
|
|
|
|
const noodlEditorExternalViewerPath = path.join(outPath, 'cloudruntime');
|
|
|
|
function stripStartDirectories(targetPath, numDirs) {
|
|
const p = targetPath.split('/');
|
|
p.splice(0, numDirs);
|
|
return p.join(path.sep);
|
|
}
|
|
|
|
const prefix = `const { ipcRenderer } = require('electron'); const _noodl_cloud_runtime_version = "${runtimeVersion}";`;
|
|
|
|
module.exports = merge(common, {
|
|
entry: {
|
|
sandbox: './src/sandbox.viewer.js'
|
|
},
|
|
output: {
|
|
filename: 'sandbox.viewer.bundle.js',
|
|
path: noodlEditorExternalViewerPath
|
|
},
|
|
plugins: [
|
|
new webpack.BannerPlugin({
|
|
banner: prefix,
|
|
raw: true
|
|
}),
|
|
new CleanWebpackPlugin(noodlEditorExternalViewerPath, {
|
|
allowExternal: true
|
|
}),
|
|
new CopyWebpackPlugin([
|
|
{
|
|
from: 'static/viewer/**/*',
|
|
transformPath: (targetPath) => stripStartDirectories(targetPath, 2)
|
|
}
|
|
]),
|
|
new GenerateJsonPlugin('manifest.json', {
|
|
version: runtimeVersion
|
|
})
|
|
]
|
|
});
|