webpack.config.js 1.37 KB
const path = require('path');
const jsdoc = require('jsdoc-webpack-plugin');
const copy = require('copy-webpack-plugin');
const eslint = require('eslint-webpack-plugin');

module.exports = {
    experiments : {
        outputModule: true
    },
    entry: { 
        'arcs' : {
            import : './src/exports.js',
        },
    },
    mode: 'none',
    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, 'build'),
        library: {
            type: 'module',
        }
    },
    module: {
        parser: {
            javascript: {
                commonjsMagicComments: true
            }
        }
    },
    plugins: [
        new jsdoc({
            conf: 'docs/engine.conf.json',
            destination:  'docs/engine',
            template: 'docs/arcs',            
        }),
        new jsdoc({
            conf: 'docs/components.conf.json',
            destination:  'docs/components',
            template: 'docs/arcs',            
        }),
        new copy({
            patterns: [
                { from : 'src/arcs_browser.js', to: 'arcs_browser.js'},
                { from: 'src/arcs_node.mjs', to: 'arcs_node.mjs'}
                // TODO put here also files for dep directory.
                // can also prepend content and replace strings using the transform property!
            ]            
        }),
        new eslint({})
    ]
};