@@ -8,7 +8,7 @@ const merge = require('webpack-merge')
88const GitRevisionPlugin = require ( 'git-revision-webpack-plugin' )
99const gitRevisionPlugin = new GitRevisionPlugin ( )
1010
11- const rootDir = path . resolve ( __dirname , '..' )
11+ const PROJECT_ROOT = path . resolve ( __dirname , '..' )
1212
1313module . exports = function ( options = { } ) {
1414 const {
@@ -21,24 +21,18 @@ module.exports = function (options={}) {
2121 `${ process . env . QINIU_SERVER } /` : path . join ( '/' , staticDir , '/' ) ;
2222return {
2323 entry : {
24- main : [ path . join ( rootDir , 'app' ) ] ,
25- workspaces : [ path . join ( rootDir , 'app/workspaces_standalone' ) ] ,
24+ main : [ path . join ( PROJECT_ROOT , 'app' ) ] ,
25+ workspaces : [ path . join ( PROJECT_ROOT , 'app/workspaces_standalone' ) ] ,
2626 vendor : [ 'babel-polyfill' , 'react' , 'react-dom' , 'redux' , 'react-redux' ] ,
2727 } ,
2828 output : {
2929 publicPath,
30- path : path . join ( rootDir , 'build' , staticDir ) ,
30+ path : path . join ( PROJECT_ROOT , 'build' , staticDir ) ,
3131 filename : '[name].[hash].js'
3232 } ,
3333 resolve : {
3434 extensions : [ '*' , '.js' , '.jsx' ] ,
35- alias : {
36- 'app' : path . join ( rootDir , 'app' ) ,
37- 'utils' : path . join ( rootDir , 'app/utils' ) ,
38- 'config' : path . join ( rootDir , 'app/config.js' ) ,
39- 'commons' : path . join ( rootDir , 'app/commons' ) ,
40- 'components' : path . join ( rootDir , 'app/components' ) ,
41- }
35+ modules : [ 'node_modules' , path . join ( PROJECT_ROOT , 'app' ) ] ,
4236 } ,
4337 resolveLoader : {
4438 modules : [ path . resolve ( __dirname , "./loaders/" ) , "node_modules" ]
@@ -62,16 +56,16 @@ return {
6256 title : 'Coding WebIDE' ,
6357 excludeChunks : [ 'workspaces' ] ,
6458 filename : ( staticDir ? '../' : '' ) + mainEntryHtmlName ,
65- template : path . join ( rootDir , 'app/index.html' )
59+ template : path . join ( PROJECT_ROOT , 'app/index.html' )
6660 } ) ,
6761 new HtmlWebpackPlugin ( {
6862 title : 'Coding WebIDE' ,
6963 excludeChunks : [ 'main' ] ,
7064 filename : ( staticDir ? '../' : '' ) + workspacesEntryHtmlName ,
71- template : path . join ( rootDir , 'app/workspaces_standalone/index.html' )
65+ template : path . join ( PROJECT_ROOT , 'app/workspaces_standalone/index.html' )
7266 } ) ,
7367 new CopyWebpackPlugin ( [ {
74- from : path . join ( rootDir , 'static/favicon.ico' ) ,
68+ from : path . join ( PROJECT_ROOT , 'static/favicon.ico' ) ,
7569 to : ( staticDir ? '../' : './' ) ,
7670 } ] )
7771 ] ,
0 commit comments