Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivWeb
Commits
17c0fb35
Commit
17c0fb35
authored
4 years ago
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add webpack outpath
parent
ed789439
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
106 additions
and
11 deletions
+106
-11
webpack.base.babel.dev.js
internals/webpack/dist/webpack.base.babel.dev.js
+4
-2
webpack.base.babel.js
internals/webpack/webpack.base.babel.js
+5
-4
package.json
package.json
+2
-2
index.dev.js
server/dist/index.dev.js
+87
-0
port.dev.js
server/dist/port.dev.js
+7
-0
index.js
server/index.js
+0
-1
port.js
server/port.js
+1
-1
BasicLayout.js
src/layouts/BasicLayout.js
+0
-1
No files found.
internals/webpack/dist/webpack.base.babel.dev.js
View file @
17c0fb35
...
@@ -10,6 +10,8 @@ var pkg = require('../../package.json');
...
@@ -10,6 +10,8 @@ var pkg = require('../../package.json');
var
CopyPlugin
=
require
(
'copy-webpack-plugin'
);
var
CopyPlugin
=
require
(
'copy-webpack-plugin'
);
var
argv
=
require
(
'../../server/argv'
);
var
ASSET_PATH
=
process
.
env
.
ASSET_PATH
||
'/'
;
var
ASSET_PATH
=
process
.
env
.
ASSET_PATH
||
'/'
;
module
.
exports
=
function
(
options
)
{
module
.
exports
=
function
(
options
)
{
...
@@ -17,7 +19,7 @@ module.exports = function (options) {
...
@@ -17,7 +19,7 @@ module.exports = function (options) {
mode
:
options
.
mode
,
mode
:
options
.
mode
,
entry
:
options
.
entry
,
entry
:
options
.
entry
,
output
:
Object
.
assign
({
output
:
Object
.
assign
({
path
:
path
.
resolve
(
process
.
cwd
(),
pkg
.
name
.
toLocaleLowerCase
()),
path
:
path
.
resolve
(
argv
.
releasepath
,
pkg
.
name
.
toLocaleLowerCase
())
||
path
.
resolve
(
process
.
cwd
(),
pkg
.
name
.
toLocaleLowerCase
()),
publicPath
:
"/"
.
concat
(
pkg
.
name
.
toLocaleLowerCase
())
publicPath
:
"/"
.
concat
(
pkg
.
name
.
toLocaleLowerCase
())
},
options
.
output
),
},
options
.
output
),
// Merge with env dependent settings
// Merge with env dependent settings
...
@@ -146,7 +148,7 @@ module.exports = function (options) {
...
@@ -146,7 +148,7 @@ module.exports = function (options) {
'process.env.ASSET_PATH'
:
JSON
.
stringify
(
ASSET_PATH
)
'process.env.ASSET_PATH'
:
JSON
.
stringify
(
ASSET_PATH
)
}),
new
CopyPlugin
([{
}),
new
CopyPlugin
([{
from
:
path
.
resolve
(
process
.
cwd
(),
'theme'
),
from
:
path
.
resolve
(
process
.
cwd
(),
'theme'
),
to
:
path
.
resolve
(
process
.
cwd
(),
""
.
concat
(
pkg
.
name
.
toLocaleLowerCase
(),
"/theme"
))
to
:
path
.
resolve
(
argv
.
releasepath
||
process
.
cwd
(),
""
.
concat
(
pkg
.
name
.
toLocaleLowerCase
(),
"/theme"
))
}])]),
}])]),
resolve
:
{
resolve
:
{
modules
:
[
'node_modules'
,
'src'
],
modules
:
[
'node_modules'
,
'src'
],
...
...
This diff is collapsed.
Click to expand it.
internals/webpack/webpack.base.babel.js
View file @
17c0fb35
...
@@ -3,13 +3,14 @@ const webpack = require('webpack');
...
@@ -3,13 +3,14 @@ const webpack = require('webpack');
const
slash
=
require
(
'slash2'
);
const
slash
=
require
(
'slash2'
);
const
pkg
=
require
(
'../../package.json'
);
const
pkg
=
require
(
'../../package.json'
);
const
CopyPlugin
=
require
(
'copy-webpack-plugin'
);
const
CopyPlugin
=
require
(
'copy-webpack-plugin'
);
const
argv
=
require
(
'../../server/argv'
);
const
ASSET_PATH
=
process
.
env
.
ASSET_PATH
||
'/'
;
const
ASSET_PATH
=
process
.
env
.
ASSET_PATH
||
'/'
;
module
.
exports
=
options
=>
({
module
.
exports
=
options
=>
({
mode
:
options
.
mode
,
mode
:
options
.
mode
,
entry
:
options
.
entry
,
entry
:
options
.
entry
,
output
:
Object
.
assign
(
output
:
Object
.
assign
(
{
{
path
:
path
.
resolve
(
process
.
cwd
(),
pkg
.
name
.
toLocaleLowerCase
()),
path
:
path
.
resolve
(
argv
.
releasepath
,
pkg
.
name
.
toLocaleLowerCase
())
||
path
.
resolve
(
process
.
cwd
(),
pkg
.
name
.
toLocaleLowerCase
()),
publicPath
:
`/
${
pkg
.
name
.
toLocaleLowerCase
()}
`
,
publicPath
:
`/
${
pkg
.
name
.
toLocaleLowerCase
()}
`
,
},
},
options
.
output
,
options
.
output
,
...
@@ -33,8 +34,7 @@ module.exports = options => ({
...
@@ -33,8 +34,7 @@ module.exports = options => ({
test
:
/
\.
css$/
,
test
:
/
\.
css$/
,
exclude
:
/node_modules/
,
exclude
:
/node_modules/
,
use
:
[
'style-loader'
,
'css-loader'
],
use
:
[
'style-loader'
,
'css-loader'
],
},
},
{
{
test
:
/
\.
less$/
,
test
:
/
\.
less$/
,
use
:
[
use
:
[
...
@@ -165,12 +165,13 @@ module.exports = options => ({
...
@@ -165,12 +165,13 @@ module.exports = options => ({
}),
}),
new
webpack
.
DefinePlugin
({
new
webpack
.
DefinePlugin
({
'process.env.ASSET_PATH'
:
JSON
.
stringify
(
ASSET_PATH
),
'process.env.ASSET_PATH'
:
JSON
.
stringify
(
ASSET_PATH
),
}),
}),
new
CopyPlugin
([
new
CopyPlugin
([
{
{
from
:
path
.
resolve
(
process
.
cwd
(),
'theme'
),
from
:
path
.
resolve
(
process
.
cwd
(),
'theme'
),
to
:
path
.
resolve
(
to
:
path
.
resolve
(
process
.
cwd
(),
argv
.
releasepath
||
process
.
cwd
(),
`
${
pkg
.
name
.
toLocaleLowerCase
()}
/theme`
,
`
${
pkg
.
name
.
toLocaleLowerCase
()}
/theme`
,
),
),
},
},
...
...
This diff is collapsed.
Click to expand it.
package.json
View file @
17c0fb35
...
@@ -21,9 +21,9 @@
...
@@ -21,9 +21,9 @@
"prebuild"
:
"npm run build:clean"
,
"prebuild"
:
"npm run build:clean"
,
"build"
:
"cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout"
,
"build"
:
"cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout"
,
"build:clean"
:
"rimraf ./build"
,
"build:clean"
:
"rimraf ./build"
,
"start"
:
"cross-env NODE_ENV=development node server"
,
"start"
:
"cross-env NODE_ENV=development node server
--port=$port
"
,
"start:tunnel"
:
"cross-env NODE_ENV=development ENABLE_TUNNEL=true node server"
,
"start:tunnel"
:
"cross-env NODE_ENV=development ENABLE_TUNNEL=true node server"
,
"start:production"
:
"npm run test && npm run build && npm run start:prod"
,
"start:production"
:
"npm run test && npm run build && npm run start:prod"
,
"start:prod"
:
"cross-env NODE_ENV=production node server"
,
"start:prod"
:
"cross-env NODE_ENV=production node server"
,
"release"
:
"np --no-cleanup --yolo --no-publish"
,
"release"
:
"np --no-cleanup --yolo --no-publish"
,
"cm"
:
"git-cz"
,
"cm"
:
"git-cz"
,
...
...
This diff is collapsed.
Click to expand it.
server/dist/index.dev.js
0 → 100644
View file @
17c0fb35
"use strict"
;
/* eslint consistent-return:0 import/order:0 */
var
express
=
require
(
'express'
);
var
logger
=
require
(
'./logger'
);
var
argv
=
require
(
'./argv'
);
var
port
=
require
(
'./port'
);
var
setup
=
require
(
'./middlewares/frontendMiddleware'
);
var
isDev
=
process
.
env
.
NODE_ENV
!==
'production'
;
var
pkg
=
require
(
'../package.json'
);
var
ngrok
=
isDev
&&
process
.
env
.
ENABLE_TUNNEL
||
argv
.
tunnel
?
require
(
'ngrok'
)
:
false
;
var
_require
=
require
(
'path'
),
resolve
=
_require
.
resolve
;
var
app
=
express
();
setup
(
app
,
{
outputPath
:
resolve
(
process
.
cwd
(),
pkg
.
name
.
toLocaleLowerCase
()),
publicPath
:
"/"
.
concat
(
pkg
.
name
.
toLocaleLowerCase
())
});
var
customHost
=
argv
.
host
||
process
.
env
.
HOST
;
var
host
=
customHost
||
null
;
var
prettyHost
=
customHost
||
'localhost'
;
// use the gzipped bundle
app
.
get
(
'*.js'
,
function
(
req
,
res
,
next
)
{
req
.
url
=
req
.
url
+
'.gz'
;
// eslint-disable-line
res
.
set
(
'Content-Encoding'
,
'gzip'
);
next
();
});
// Start your app.
app
.
listen
(
port
,
host
,
function
_callee
(
err
)
{
var
url
;
return
regeneratorRuntime
.
async
(
function
_callee$
(
_context
)
{
while
(
1
)
{
switch
(
_context
.
prev
=
_context
.
next
)
{
case
0
:
if
(
!
err
)
{
_context
.
next
=
2
;
break
;
}
return
_context
.
abrupt
(
"return"
,
logger
.
error
(
err
.
message
));
case
2
:
if
(
!
ngrok
)
{
_context
.
next
=
15
;
break
;
}
_context
.
prev
=
3
;
_context
.
next
=
6
;
return
regeneratorRuntime
.
awrap
(
ngrok
.
connect
(
port
));
case
6
:
url
=
_context
.
sent
;
_context
.
next
=
12
;
break
;
case
9
:
_context
.
prev
=
9
;
_context
.
t0
=
_context
[
"catch"
](
3
);
return
_context
.
abrupt
(
"return"
,
logger
.
error
(
_context
.
t0
));
case
12
:
logger
.
appStarted
(
port
,
prettyHost
,
url
);
_context
.
next
=
16
;
break
;
case
15
:
logger
.
appStarted
(
port
,
prettyHost
);
case
16
:
case
"end"
:
return
_context
.
stop
();
}
}
},
null
,
null
,
[[
3
,
9
]]);
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
server/dist/port.dev.js
0 → 100644
View file @
17c0fb35
"use strict"
;
var
argv
=
require
(
'./argv'
);
console
.
log
(
argv
.
port
);
module
.
exports
=
parseInt
(
argv
.
port
||
process
.
env
.
PORT
||
'3005'
,
10
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
server/index.js
View file @
17c0fb35
...
@@ -19,7 +19,6 @@ setup(app, {
...
@@ -19,7 +19,6 @@ setup(app, {
outputPath
:
resolve
(
process
.
cwd
(),
pkg
.
name
.
toLocaleLowerCase
()),
outputPath
:
resolve
(
process
.
cwd
(),
pkg
.
name
.
toLocaleLowerCase
()),
publicPath
:
`/
${
pkg
.
name
.
toLocaleLowerCase
()}
`
,
publicPath
:
`/
${
pkg
.
name
.
toLocaleLowerCase
()}
`
,
});
});
const
customHost
=
argv
.
host
||
process
.
env
.
HOST
;
const
customHost
=
argv
.
host
||
process
.
env
.
HOST
;
const
host
=
customHost
||
null
;
const
host
=
customHost
||
null
;
const
prettyHost
=
customHost
||
'localhost'
;
const
prettyHost
=
customHost
||
'localhost'
;
...
...
This diff is collapsed.
Click to expand it.
server/port.js
View file @
17c0fb35
const
argv
=
require
(
'./argv'
);
const
argv
=
require
(
'./argv'
);
console
.
log
(
argv
.
port
)
module
.
exports
=
parseInt
(
argv
.
port
||
process
.
env
.
PORT
||
'3005'
,
10
);
module
.
exports
=
parseInt
(
argv
.
port
||
process
.
env
.
PORT
||
'3005'
,
10
);
This diff is collapsed.
Click to expand it.
src/layouts/BasicLayout.js
View file @
17c0fb35
...
@@ -482,7 +482,6 @@ const BasicLayout = props => {
...
@@ -482,7 +482,6 @@ const BasicLayout = props => {
hideInMenu
:
false
,
hideInMenu
:
false
,
routes
:
item
.
routes
?
item
.
routes
:
undefined
,
routes
:
item
.
routes
?
item
.
routes
:
undefined
,
};
};
console
.
log
(
"localItem"
,
localItem
)
return
localItem
return
localItem
});
});
});
});
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment