Skip to content

Commit

Permalink
update webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
dmca-glasgow committed Jan 24, 2022
1 parent f889695 commit 18221fb
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions compiler/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const CopyPlugin = require('copy-webpack-plugin');
const ShebangPlugin = require('webpack-shebang-plugin');
const InlineEnvironmentVariablesPlugin = require('inline-environment-variables-webpack-plugin');
import path from "path";
// import { CleanWebpackPlugin } from "clean-webpack-plugin";
import nodeExternals from "webpack-node-externals";
import CopyPlugin from "copy-webpack-plugin";
import ShebangPlugin from "webpack-shebang-plugin";
import InlineEnvironmentVariablesPlugin from "inline-environment-variables-webpack-plugin";
// const GeneratePackageJsonPlugin = require('generate-package-json-webpack-plugin');

// const pkg = require('./package.json');

const isProd = process.env.NODE_ENV === 'production'
const __dirname = new URL('.', import.meta.url).pathname;

module.exports = {
entry: {
compiler: path.join(__dirname, 'src/index.ts'),
cli: path.join(__dirname, 'src/cli/cli.ts')
},
export default {
target: ['node', 'es2020'],
mode: isProd ? 'production' : 'development',
target: 'node',
devtool: 'cheap-module-source-map',
entry: './src/cli/cli.ts',
// stats: 'errors-only',
resolve: {
extensions: ['.ts', '.js', '.css']
},
output: {
clean: true,
path: path.join(__dirname, 'build'),
filename: '[name].js',
filename: 'index.js',
},
resolve: {
extensions: ['.ts', '.js', '.css']
externals: nodeExternals({
importType: 'module',
modulesFromFile: true,
}),
optimization: {
minimize: false,
},
module: {
rules: [
Expand All @@ -37,19 +45,18 @@ module.exports = {
},
]
},
// {
// test: /\/assets\//,
// use: 'raw-loader',
// },
{
test: /\/assets\//,
use: 'raw-loader',
},
// {
// test: /\/template\/build\//,
// use: 'raw-loader',
// },
]
},
externals: [nodeExternals({ modulesFromFile: true })],
plugins: [
new CleanWebpackPlugin(),
// new CleanWebpackPlugin(),
new ShebangPlugin(),
// new GeneratePackageJsonPlugin(
// {
Expand All @@ -69,7 +76,4 @@ module.exports = {
],
}),
],
optimization: {
minimize: false,
},
};

0 comments on commit 18221fb

Please sign in to comment.