Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dbgame-build
Project
Project
Details
Activity
Releases
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
wildfirecode13
dbgame-build
Commits
26d1c5f9
Commit
26d1c5f9
authored
Sep 07, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
ce070688
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
20 deletions
+23
-20
dev-server.js
build/dev-server.js
+17
-9
webpack.base.conf.js
build/webpack.base.conf.js
+5
-4
index.js
index.js
+1
-7
No files found.
build/dev-server.js
View file @
26d1c5f9
...
...
@@ -9,12 +9,20 @@ var serverStart = opts => {
let
webpackConfig
=
devConfig
(
opts
);
// 遍历每个entry,加入dev-server client
Object
.
keys
(
webpackConfig
.
entry
).
forEach
(
function
(
name
)
{
let
_devServer
=
`webpack-dev-server/client?http://localhost:
${
opts
.
devPort
}
`
;
webpackConfig
.
entry
[
name
]
=
[
_devServer
].
concat
(
webpackConfig
.
entry
[
name
]);
});
// Object.keys(webpackConfig.entry).forEach(function (name) {
// let _devServer = `webpack-dev-server/client?http://localhost:${
// opts.devPort
// }`;
// webpackConfig.entry[name] = [_devServer].concat(webpackConfig.entry[name]);
// });
// 遍历每个entry,加入dev-server client
let
_devServer
=
`webpack-dev-server/client?http://localhost:
${
opts
.
devPort
}
`
;
webpackConfig
.
entry
=
[
_devServer
].
concat
(
webpackConfig
.
entry
);
var
compiler
=
webpack
(
webpackConfig
);
...
...
@@ -23,20 +31,20 @@ var serverStart = opts => {
host
:
'0.0.0.0'
,
watchContentBase
:
true
,
watchOptions
:
opts
.
devServerWatchOptions
,
contentBase
:
`.`
,
contentBase
:
'.'
,
proxy
:
opts
.
proxy
,
after
(
app
)
{
// 自动打开浏览器
if
(
opts
.
BUILD_SKIN
)
{
opn
(
`http://localhost:
${
opts
.
devPort
}
/
${
opts
.
BUILD_SKIN
}
/index.html`
path
.
join
(
`http://localhost:
${
opts
.
devPort
}
`
,
opts
.
BUILD_SKIN
,
'index.html'
)
);
}
}
};
WebpackDevServer
.
addDevServerEntrypoints
(
webpackConfig
,
devServerOptions
);
//
WebpackDevServer.addDevServerEntrypoints(webpackConfig, devServerOptions);
const
devServer
=
new
WebpackDevServer
(
compiler
,
devServerOptions
);
devServer
.
listen
(
opts
.
devPort
,
'0.0.0.0'
,
()
=>
{
console
.
log
(
`Starting server ...`
);
...
...
build/webpack.base.conf.js
View file @
26d1c5f9
...
...
@@ -2,9 +2,10 @@ const path = require('path');
module
.
exports
=
opts
=>
{
const
result
=
{
entry
:
{
app
:
`./
${
opts
.
BUILD_SKIN
}
/src/Main.ts`
},
entry
:
`./
${
opts
.
BUILD_SKIN
}
/src/Main.ts`
,
// entry: {
// app: path.join(opts.BUILD_SKIN, '/src/Main.ts')
// },
module
:
{
rules
:
[
{
...
...
@@ -19,7 +20,7 @@ module.exports = opts => {
extensions
:
[
'.tsx'
,
'.ts'
,
'.js'
]
},
output
:
{
filename
:
`./output.js`
,
filename
:
`./
${
opts
.
BUILD_SKIN
}
/
output.js`
,
path
:
__dirname
}
};
...
...
index.js
View file @
26d1c5f9
...
...
@@ -7,13 +7,7 @@ class DuibaGameBuild {
constructor
(
config
)
{
let
defaults
=
{
devPort
:
8081
,
devServerWatchOptions
:
{
ignored
:
[
'src/**/*.js'
,
'**/*.md'
,
'bin-release'
,
]
},
devServerWatchOptions
:
{},
proxy
:
{
'/ngapi/*'
:
'http://localhost:3000'
,
'/plugin/*'
:
'http://localhost:3000'
,
...
...
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