mirror of https://github.com/artf/grapesjs.git
nocodeframeworkdrag-and-dropsite-buildersite-generatortemplate-builderui-builderweb-builderweb-builder-frameworkwebsite-builderno-codepage-builder
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.5 KiB
62 lines
1.5 KiB
import webpack, { type Configuration } from 'webpack';
|
|
import NodeExternals from 'webpack-node-externals';
|
|
import CopyPlugin from 'copy-webpack-plugin';
|
|
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
|
import { resolve } from 'path';
|
|
|
|
const MODE = process.env.BUILD_MODE === 'production' ? 'production' : 'development';
|
|
|
|
const config: Configuration = {
|
|
context: process.cwd(),
|
|
mode: MODE,
|
|
entry: './src/cli.ts',
|
|
output: {
|
|
filename: 'cli.js',
|
|
path: resolve(__dirname, 'dist'),
|
|
},
|
|
target: 'node',
|
|
stats: {
|
|
preset: 'minimal',
|
|
warnings: false,
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(jsx?|tsx?)$/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
cacheDirectory: true,
|
|
presets: ['@babel/preset-typescript'],
|
|
assumptions: {
|
|
setPublicClassFields: false,
|
|
},
|
|
},
|
|
},
|
|
exclude: [/node_modules/],
|
|
},
|
|
],
|
|
},
|
|
resolve: {
|
|
extensions: ['.ts', '.tsx', '.js', '.jsx', '.d.ts'],
|
|
},
|
|
plugins: [
|
|
new ForkTsCheckerWebpackPlugin(),
|
|
new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),
|
|
new CopyPlugin({
|
|
patterns: [
|
|
{ from: 'src/banner.txt', to: 'banner.txt' },
|
|
{
|
|
from: 'src/template',
|
|
to: 'template',
|
|
// Terser skip this file for minimization
|
|
info: { minimized: true },
|
|
},
|
|
],
|
|
}),
|
|
],
|
|
externalsPresets: { node: true },
|
|
externals: [NodeExternals()],
|
|
};
|
|
|
|
export default config;
|
|
|