Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
production = true,
output = "build",
serverPlugins = [],
clientPlugins = []
}) => {
const MODE = production ? "production" : "development";
const DEVTOOL = production ? "source-map" : "cheap-module-source-map";
const BUILD_PATH = path.resolve(CWD, production ? output : "");
const ASSETS_PATH = path.join(BUILD_PATH, "assets");
const PUBLIC_PATH = "/assets/";
const APP_DIR = dir || path.dirname(file);
// getClientCompilerName gets stringified and added to the output bundle
// if it is instrumented, the cov_${id} variable will cause a ReferenceError
/* istanbul ignore next */
const markoPlugin = new MarkoPlugin({
getClientCompilerName:
production &&
($global => ($global.isModern ? "Browser-modern" : "Browser-legacy"))
});
const markoCompiler = (() => {
process.env.APP_DIR = APP_DIR;
return require.resolve("./marko-compiler");
})();
const legacyBrowsers =
browserslist.loadConfig({
path: dir || file,
env: "legacy"
}) || browserslist.defaults;
/* eslint-disable no-console */
const fs = require('fs-extra');
const path = require('path');
const webpack = require('webpack');
const MarkoPlugin = require('@marko/webpack/plugin').default;
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries');
const ExtractCssChunks = require('extract-css-chunks-webpack-plugin');
const templates = require(`${__dirname}/../../../dist/etc/templates.json`);
const markoPlugin = new MarkoPlugin();
const config = require('../../../dist/static/etc/config.json');
const configTools = {
name: 'Tools',
entry: {
app: `${__dirname}/../api/tools.js`
},
output: {
path: `${__dirname}/../../../dist/bin`,
filename: 'tools.js'
},
target: 'node',
node: {
__dirname: false,
__filename: false,