File tree 6 files changed +80
-26
lines changed
6 files changed +80
-26
lines changed Original file line number Diff line number Diff line change 6
6
"main" : " dist/aframe-master.js" ,
7
7
"scripts" : {
8
8
"dev" : " cross-env INSPECTOR_VERSION=dev webpack serve --port 8080" ,
9
- "dist" : " node scripts/updateVersionLog.js && npm run dist:min && npm run dist:max" ,
10
- "dist:max" : " webpack --config webpack.config.js" ,
11
- "dist:min" : " webpack --config webpack.prod.config.js" ,
9
+ "dist" : " node scripts/updateVersionLog.js && npm run dist:min && npm run dist:max && npm run dist:module" ,
10
+ "dist:max" : " webpack --config webpack.config.cjs" ,
11
+ "dist:min" : " webpack --config webpack.prod.config.cjs" ,
12
+ "dist:module" : " webpack --config webpack.module.config.cjs" ,
12
13
"docs" : " markserv --dir docs --port 9001" ,
13
14
"preghpages" : " node ./scripts/preghpages.js" ,
14
15
"ghpages" : " gh-pages -d gh-pages" ,
Original file line number Diff line number Diff line change 2
2
var path = require ( 'path' ) ;
3
3
var glob = require ( 'glob' ) ;
4
4
var webpack = require ( 'webpack' ) ;
5
- var webpackConfiguration = require ( '../webpack.config.js ' ) ;
5
+ var webpackConfiguration = require ( '../webpack.common.cjs ' ) ;
6
6
7
7
// Define test files.
8
8
var FILES = [
@@ -38,7 +38,18 @@ webpackConfiguration.plugins.push(new webpack.ProvidePlugin({
38
38
process : 'process/browser'
39
39
} ) ) ;
40
40
// webpack will create a lot of files, use build directory instead of dist
41
- webpackConfiguration . output . path = path . resolve ( __dirname , '../build' ) ;
41
+ webpackConfiguration . output = {
42
+ library : {
43
+ name : 'AFRAME' ,
44
+ type : 'var' ,
45
+ export : 'default'
46
+ } ,
47
+ libraryTarget : 'umd' ,
48
+ path : path . resolve ( __dirname , '../build' ) ,
49
+ publicPath : '/dist/' ,
50
+ filename : 'aframe-master.js'
51
+ } ;
52
+ webpackConfiguration . mode = 'development' ;
42
53
43
54
var karmaConf = {
44
55
basePath : '../' ,
Original file line number Diff line number Diff line change @@ -3,27 +3,7 @@ var webpack = require('webpack');
3
3
4
4
module . exports = {
5
5
entry : './src/index.js' ,
6
- output : {
7
- library : {
8
- name : 'AFRAME' ,
9
- type : 'var' ,
10
- export : 'default'
11
- } ,
12
- libraryTarget : 'umd' ,
13
- path : path . resolve ( __dirname , 'dist' ) ,
14
- publicPath : '/dist/' ,
15
- filename : 'aframe-master.js'
16
- } ,
17
6
devtool : 'source-map' ,
18
- mode : 'development' ,
19
- devServer : {
20
- port : process . env . PORT || 9000 ,
21
- hot : false ,
22
- liveReload : true ,
23
- static : {
24
- directory : 'examples'
25
- }
26
- } ,
27
7
plugins : [
28
8
new webpack . DefinePlugin ( {
29
9
INSPECTOR_VERSION : JSON . stringify (
Original file line number Diff line number Diff line change
1
+ var path = require ( 'path' ) ;
2
+ var webpack = require ( 'webpack' ) ;
3
+
4
+ module . exports = {
5
+ extends : [ 'webpack.common.cjs' ] ,
6
+ output : {
7
+ library : {
8
+ name : 'AFRAME' ,
9
+ type : 'var' ,
10
+ export : 'default'
11
+ } ,
12
+ libraryTarget : 'umd' ,
13
+ path : path . resolve ( __dirname , 'dist' ) ,
14
+ publicPath : '/dist/' ,
15
+ filename : 'aframe-master.js'
16
+ } ,
17
+ mode : 'development' ,
18
+ devServer : {
19
+ port : process . env . PORT || 9000 ,
20
+ hot : false ,
21
+ liveReload : true ,
22
+ static : {
23
+ directory : 'examples'
24
+ }
25
+ }
26
+ } ;
Original file line number Diff line number Diff line change
1
+ var path = require ( 'path' ) ;
2
+ var TerserPlugin = require ( 'terser-webpack-plugin' ) ;
3
+
4
+ module . exports = {
5
+ extends : [ 'webpack.common.cjs' ] ,
6
+ output : {
7
+ libraryTarget : 'module' ,
8
+ path : path . resolve ( __dirname , 'dist' ) ,
9
+ publicPath : '/dist/' ,
10
+ filename : 'aframe-master.module.min.js'
11
+ } ,
12
+ experiments : {
13
+ outputModule : true
14
+ } ,
15
+ externalsType : 'module' ,
16
+ externals : {
17
+ three : 'three'
18
+ } ,
19
+ mode : 'production' ,
20
+ optimization : {
21
+ minimize : true ,
22
+ minimizer : [
23
+ new TerserPlugin ( {
24
+ terserOptions : {
25
+ compress : {
26
+ passes : 2
27
+ } ,
28
+ format : {
29
+ comments : false
30
+ }
31
+ } ,
32
+ extractComments : false
33
+ } )
34
+ ]
35
+ }
36
+ } ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ var path = require('path');
2
2
var TerserPlugin = require ( 'terser-webpack-plugin' ) ;
3
3
4
4
module . exports = {
5
- extends : [ 'webpack.config.js ' ] ,
5
+ extends : [ 'webpack.common.cjs ' ] ,
6
6
output : {
7
7
library : {
8
8
name : 'AFRAME' ,
You can’t perform that action at this time.
0 commit comments