https://github.com/wenyan-lang/wenyan
Raw File
Tip revision: e3f7a86726664448a0efe4423d082e6ef437c564 authored by Anthony Fu on 02 January 2020, 06:53:41 UTC
Merge branch 'release' of https://github.com/LingDong-/wenyan-lang into release
Tip revision: e3f7a86
webpack.config.js
const path = require('path')
const webpack = require('webpack')

const Default = () => {
  return {
    devtool: 'source-map',
    output: {
      globalObject: '(typeof self !== "undefined" ? self : this)', // make it works for both node and browser
      libraryTarget: 'umd2',
      library: ["Wenyan", "[name]"],
      path: path.resolve(__dirname, 'dist'),
      filename: '[name]/index.min.js',
    },
    resolve: {
      extensions: ['.ts', '.js'],
    },
    module: {
      rules: [
        {
          test: /\.wy$/i,
          use: 'raw-loader',
        },
      ],
    },
  }
};

const Cli = {
  ...Default(),
  target: 'node',
  entry: {
    cli: './src/cli.js',
  },
  plugins: [
    new webpack.BannerPlugin({
      banner: '#!/usr/bin/env node',
      raw: true,
    }),
  ],
  mode: "development",
  optimization: {
		minimize: false,
	},
}

const Core = {
  ...Default(),
  entry: {
    core: './src/parser.js',
  }
}

Core.output.library = 'Wenyan'

const Utils = {
  ...Default(),
  entry: {
    render: './src/render.js',
    runtime: './src/browser_runtime.js',
  }
}

module.exports = [Cli, Core, Utils]
back to top