c7fdc6acc2
* chore: updating ws in various ways * puppeteer upgrade * updating codegen deps * workspaces cmd update * various extra fixes * minor preview-service troubleshooting improvements * dockerfile fixes * hopefully fixing docker build fe2 * try again * try large again
73 lines
1.6 KiB
JavaScript
73 lines
1.6 KiB
JavaScript
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
|
const path = require('path')
|
|
const yargs = require('yargs')
|
|
const env = yargs.argv.env
|
|
|
|
const filename = 'viewer'
|
|
|
|
let outputFile, mode
|
|
|
|
if (env === 'build') {
|
|
mode = 'production'
|
|
outputFile = filename + '.min.js'
|
|
} else {
|
|
mode = 'development'
|
|
outputFile = filename + '.js'
|
|
}
|
|
|
|
/**
|
|
* @type {import('webpack').Configuration}
|
|
*/
|
|
const config = {
|
|
mode,
|
|
entry: path.resolve(__dirname + '/render_page/src/app.js'),
|
|
target: 'web',
|
|
devtool: 'source-map',
|
|
output: {
|
|
path: path.resolve(__dirname + '/public/render'),
|
|
filename: outputFile
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /(\.jsx|\.js|\.ts|\.tsx)$/,
|
|
use: {
|
|
loader: 'babel-loader'
|
|
},
|
|
exclude: /(node_modules|bower_components)/
|
|
},
|
|
{
|
|
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
type: 'asset/resource'
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new CleanWebpackPlugin({ cleanStaleWebpackAssets: false }),
|
|
new HtmlWebpackPlugin({
|
|
title: 'Speckle Viewer Example',
|
|
template: 'render_page/src/example.html',
|
|
filename: 'index.html',
|
|
favicon: 'render_page/src/favicon.ico'
|
|
})
|
|
],
|
|
resolve: {
|
|
modules: [
|
|
path.resolve('../../node_modules'),
|
|
path.resolve('./node_modules'),
|
|
path.resolve('.render_page/src')
|
|
],
|
|
extensions: ['.json', '.js']
|
|
},
|
|
devServer: {
|
|
contentBase: path.join(__dirname, 'example'),
|
|
compress: false,
|
|
port: 9000,
|
|
serveIndex: true,
|
|
writeToDisk: true
|
|
}
|
|
}
|
|
|
|
module.exports = config
|