How to use @marko/webpack - 2 common examples

To help you get started, we’ve selected a few @marko/webpack examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marko-js / cli / packages / build / src / index.js View on Github external
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;
github xtremespb / zoia2 / src / shared / build / webpack.config.js View on Github external
/* 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,

@marko/webpack

a Marko plugin and loader for Webpack

MIT
Latest version published 2 months ago

Package Health Score

69 / 100
Full package analysis

Popular @marko/webpack functions