Files
speckle-server/packages/preview-service/webpack.config.render_page.js
T
Gergő Jedlicska 638969cd01 gergo/yarn (#753)
* yarn first go

* fix frontend build cache loader

* yarn workspaces built server Docker

* build(yarn): add workspaces plugin config

* chore(package defs): clean package*.json -s

* chore(gitignore): ignore yarn error log

* build(yarn): update yarn lock

* build(preview-service webpack): add extra resolved path to preview service webpack config

because of yarn package hoisting, there are no package level node_modules folder anymore.

* build(docker): update dockerignore with yarn specific configs

* build(docker): update Dockerfiles for yarn workspaces utilization

* ci(circleci): update server test job to yarn

* ci(circle): disable cache restore

* ci(circleci): trying the node orb yarn-run

* ci(circleci): yarn-run again

* ci(circleci): disable node orb

* ci(circleci): change base node image for tests

* ci(circleci): add yarn cache

* ci(circleci): remove node install step

* ci(circleci): add server specific cache archives

* ci(circleci): test build and publish

* ci(circleci): change npm auth method to suit yarn

* ci(circleci): trying new builder image

* ci(circleci): another base image, maybe this works

* ci(circleci): force a specific docker engine version

* ci(circleci): add yarn version plugin and its changes

* ci(circleci): cleanup and remove temp branch config

* chore(package defs): moving from npm run to yarn

* explicitly specifying webpack4 as a frontend dep

* chore(package defs): replace npm with yarn everywhere

* docs(root readme): update with some yarn specific docs

* chore(root workspace): update dev scripts and package lock

* ci(circleci): enable package publish step with yarn

Co-authored-by: Fabians <fabis94@live.com>
2022-05-19 19:53:07 +02:00

65 lines
1.4 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'
}
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)/
}
]
},
plugins: [
new CleanWebpackPlugin({ cleanStaleWebpackAssets: false }),
new HtmlWebpackPlugin({
title: 'Speckle Viewer Example',
template: 'render_page/src/example.html',
filename: 'index.html'
})
],
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