Jean-Yves Didier

multiple target for webpack

This diff is collapsed. Click to expand it.
...@@ -3,7 +3,9 @@ const jsdoc = require('jsdoc-webpack-plugin'); ...@@ -3,7 +3,9 @@ const jsdoc = require('jsdoc-webpack-plugin');
3 const copy = require('copy-webpack-plugin'); 3 const copy = require('copy-webpack-plugin');
4 const eslint = require('eslint-webpack-plugin'); 4 const eslint = require('eslint-webpack-plugin');
5 5
6 -module.exports = { 6 +module.exports = [
7 + {
8 + name: "core",
7 experiments : { 9 experiments : {
8 outputModule: true 10 outputModule: true
9 }, 11 },
...@@ -28,6 +30,46 @@ module.exports = { ...@@ -28,6 +30,46 @@ module.exports = {
28 } 30 }
29 }, 31 },
30 plugins: [ 32 plugins: [
33 + new eslint({}),
34 + new copy({
35 + patterns: [
36 + { from :'src/arcs_browser.js', to: 'arcs_browser.js'},
37 + { from: 'src/arcs_node.mjs', to: 'arcs_node.mjs'}
38 + ]
39 + })
40 + ]
41 + },
42 + {
43 + name: "core-min",
44 + experiments : {
45 + outputModule: true
46 + },
47 + entry: {
48 + 'arcs' : {
49 + import : './src/exports.js',
50 + },
51 + },
52 + mode: 'production',
53 + output: {
54 + filename: '[name].min.js',
55 + path: path.resolve(__dirname, 'build'),
56 + library: {
57 + type: 'module',
58 + }
59 + },
60 + module: {
61 + parser: {
62 + javascript: {
63 + commonjsMagicComments: true
64 + }
65 + }
66 + },
67 + },
68 + {
69 + name: "doc",
70 + mode: "development",
71 + entry: {},
72 + plugins: [
31 new jsdoc({ 73 new jsdoc({
32 conf: 'docs/engine.conf.json', 74 conf: 'docs/engine.conf.json',
33 destination: 'docs/engine', 75 destination: 'docs/engine',
...@@ -38,10 +80,15 @@ module.exports = { ...@@ -38,10 +80,15 @@ module.exports = {
38 destination: 'docs/components', 80 destination: 'docs/components',
39 template: 'docs/arcs', 81 template: 'docs/arcs',
40 }), 82 }),
83 + ]
84 + },
85 + {
86 + name: "deps",
87 + mode: "production",
88 + entry: {},
89 + plugins: [
41 new copy({ 90 new copy({
42 patterns: [ 91 patterns: [
43 - { from :'src/arcs_browser.js', to: 'arcs_browser.js'},
44 - { from: 'src/arcs_node.mjs', to: 'arcs_node.mjs'},
45 { from: 'node_modules/tracking/build/tracking.js', to: '../deps/tracking/tracking.js'}, 92 { from: 'node_modules/tracking/build/tracking.js', to: '../deps/tracking/tracking.js'},
46 { from: 'node_modules/three/build/three.module.js', to: '../deps/three.js/index.js'}, 93 { from: 'node_modules/three/build/three.module.js', to: '../deps/three.js/index.js'},
47 { 94 {
...@@ -108,9 +155,9 @@ module.exports = { ...@@ -108,9 +155,9 @@ module.exports = {
108 // can also prepend content and replace strings using the transform property! 155 // can also prepend content and replace strings using the transform property!
109 ] 156 ]
110 }), 157 }),
111 - new eslint({})
112 ] 158 ]
113 -}; 159 + }
160 +];
114 161
115 162
116 163
......