Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
h5-base
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
new-sing
h5-base
Commits
9f9d8c7c
Commit
9f9d8c7c
authored
Mar 08, 2019
by
chenyishuai@singsingenglish.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pull
parent
8184df19
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2085 additions
and
1932 deletions
+2085
-1932
webpack.test.conf.js
build/webpack.test.conf.js
+95
-0
dev.env.js
config/dev.env.js
+3
-2
index.js
config/index.js
+2
-1
package-lock.json
package-lock.json
+1984
-1929
package.json
package.json
+1
-0
No files found.
build/webpack.test.conf.js
0 → 100644
View file @
9f9d8c7c
'use strict'
const
utils
=
require
(
'./utils'
)
const
webpack
=
require
(
'webpack'
)
const
config
=
require
(
'../config'
)
const
merge
=
require
(
'webpack-merge'
)
const
path
=
require
(
'path'
)
const
baseWebpackConfig
=
require
(
'./webpack.base.conf'
)
const
CopyWebpackPlugin
=
require
(
'copy-webpack-plugin'
)
const
HtmlWebpackPlugin
=
require
(
'html-webpack-plugin'
)
const
FriendlyErrorsPlugin
=
require
(
'friendly-errors-webpack-plugin'
)
const
portfinder
=
require
(
'portfinder'
)
const
HOST
=
process
.
env
.
HOST
const
PORT
=
process
.
env
.
PORT
&&
Number
(
process
.
env
.
PORT
)
const
devWebpackConfig
=
merge
(
baseWebpackConfig
,
{
module
:
{
rules
:
utils
.
styleLoaders
({
sourceMap
:
config
.
dev
.
cssSourceMap
,
usePostCSS
:
true
})
},
// cheap-module-eval-source-map is faster for development
devtool
:
config
.
dev
.
devtool
,
// these devServer options should be customized in /config/index.js
devServer
:
{
clientLogLevel
:
'warning'
,
historyApiFallback
:
{
rewrites
:
[
{
from
:
/.*/
,
to
:
path
.
posix
.
join
(
config
.
dev
.
assetsPublicPath
,
'index.html'
)
},
],
},
hot
:
true
,
contentBase
:
false
,
// since we use CopyWebpackPlugin.
compress
:
true
,
host
:
HOST
||
config
.
dev
.
host
,
port
:
PORT
||
config
.
dev
.
port
,
open
:
config
.
dev
.
autoOpenBrowser
,
overlay
:
config
.
dev
.
errorOverlay
?
{
warnings
:
false
,
errors
:
true
}
:
false
,
publicPath
:
config
.
dev
.
assetsPublicPath
,
proxy
:
config
.
dev
.
proxyTable
,
quiet
:
true
,
// necessary for FriendlyErrorsPlugin
watchOptions
:
{
poll
:
config
.
dev
.
poll
,
}
},
plugins
:
[
new
webpack
.
DefinePlugin
({
'process.env'
:
require
(
'../config/test.env'
)
}),
new
webpack
.
HotModuleReplacementPlugin
(),
new
webpack
.
NamedModulesPlugin
(),
// HMR shows correct file names in console on update.
new
webpack
.
NoEmitOnErrorsPlugin
(),
// https://github.com/ampedandwired/html-webpack-plugin
new
HtmlWebpackPlugin
({
filename
:
'index.html'
,
template
:
'index.html'
,
inject
:
true
}),
// copy custom static assets
new
CopyWebpackPlugin
([
{
from
:
path
.
resolve
(
__dirname
,
'../static'
),
to
:
config
.
dev
.
assetsSubDirectory
,
ignore
:
[
'.*'
]
}
])
]
})
module
.
exports
=
new
Promise
((
resolve
,
reject
)
=>
{
portfinder
.
basePort
=
process
.
env
.
PORT
||
config
.
dev
.
port
portfinder
.
getPort
((
err
,
port
)
=>
{
if
(
err
)
{
reject
(
err
)
}
else
{
// publish the new Port, necessary for e2e tests
process
.
env
.
PORT
=
port
// add port to devServer config
devWebpackConfig
.
devServer
.
port
=
port
// Add FriendlyErrorsPlugin
devWebpackConfig
.
plugins
.
push
(
new
FriendlyErrorsPlugin
({
compilationSuccessInfo
:
{
messages
:
[
`Your application is running here: http://
${
devWebpackConfig
.
devServer
.
host
}
:
${
port
}
`
],
},
onErrors
:
config
.
dev
.
notifyOnErrors
?
utils
.
createNotifierCallback
()
:
undefined
}))
resolve
(
devWebpackConfig
)
}
})
})
config/dev.env.js
View file @
9f9d8c7c
...
...
@@ -4,10 +4,11 @@ const prodEnv = require('./prod.env');
module
.
exports
=
merge
(
prodEnv
,
{
NODE_ENV
:
'"development"'
,
API_URL
:
'"http://192.168.31.242:8085/"'
,
API_URL
:
'"http://localhost:8085/"'
,
// API_URL: '"https://wechat-test.changchangenglish.com/"',
MAX_FILESIZE
:
'1024*1024*10'
,
IMAGE_URL_HEAD
:
'"http://cdn.singsingenglish.com/"'
,
BUY_URL
:
'"http://wechat-test.changchangenglish.com/#/buyDetail?"'
,
AUTHOR_UEL
:
'"http://wechat-test.changchangenglish.com/api/client/login?redirect_url=http://
192.168.31.242
:8085/#/"'
,
AUTHOR_UEL
:
'"http://wechat-test.changchangenglish.com/api/client/login?redirect_url=http://
localhost
:8085/#/"'
,
REDIRECT_URL
:
'"http://localhost:8085/"'
,
});
config/index.js
View file @
9f9d8c7c
...
...
@@ -18,7 +18,8 @@ module.exports = {
}
},
// Various Dev Server settings
host
:
'192.168.31.242'
,
// can be overwritten by process.env.HOST
// host: '192.168.31.242', // can be overwritten by process.env.HOST
host
:
'localhost'
,
// can be overwritten by process.env.HOST
port
:
8085
,
// can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser
:
false
,
errorOverlay
:
true
,
...
...
package-lock.json
View file @
9f9d8c7c
This diff is collapsed.
Click to expand it.
package.json
View file @
9f9d8c7c
...
...
@@ -6,6 +6,7 @@
"private"
:
true
,
"scripts"
:
{
"dev"
:
"webpack-dev-server --inline --progress --config build/webpack.dev.conf.js"
,
"test"
:
"webpack-dev-server --inline --progress --config build/webpack.test.conf.js"
,
"start"
:
"npm run dev"
,
"build"
:
"node build/build.js"
,
"build-test"
:
"node build/build-test.js"
...
...
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