Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
admin-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
admin-base
Commits
6c9b1f24
Commit
6c9b1f24
authored
Aug 23, 2019
by
chenyishuai@singsingenglish.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
823
parent
1f6d6e4c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
10 deletions
+72
-10
build-pre.js
build/build-pre.js
+41
-0
webpack.prod.conf.js
build/webpack.prod.conf.js
+11
-3
index.js
config/index.js
+3
-3
pre.env.js
config/pre.env.js
+10
-0
test.env.js
config/test.env.js
+7
-4
No files found.
build/build-pre.js
0 → 100644
View file @
6c9b1f24
'use strict'
require
(
'./check-versions'
)()
process
.
env
.
NODE_ENV
=
'pre'
const
ora
=
require
(
'ora'
)
const
rm
=
require
(
'rimraf'
)
const
path
=
require
(
'path'
)
const
chalk
=
require
(
'chalk'
)
const
webpack
=
require
(
'webpack'
)
const
config
=
require
(
'../config'
)
const
webpackConfig
=
require
(
'./webpack.prod.conf'
)
const
spinner
=
ora
(
'building for testing...'
)
spinner
.
start
()
// rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
// if (err) throw err
webpack
(
webpackConfig
,
(
err
,
stats
)
=>
{
spinner
.
stop
()
if
(
err
)
throw
err
process
.
stdout
.
write
(
stats
.
toString
({
colors
:
true
,
modules
:
false
,
children
:
false
,
// If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks
:
false
,
chunkModules
:
false
})
+
'
\
n
\
n'
)
if
(
stats
.
hasErrors
())
{
console
.
log
(
chalk
.
red
(
' Build failed with errors.
\
n'
))
process
.
exit
(
1
)
}
console
.
log
(
chalk
.
cyan
(
' Build complete.
\
n'
))
console
.
log
(
chalk
.
yellow
(
' Tip: built files are meant to be served over an HTTP server.
\
n'
+
' Opening index.html over file:// won
\'
t work.
\
n'
))
})
// })
build/webpack.prod.conf.js
View file @
6c9b1f24
...
@@ -11,9 +11,17 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin')
...
@@ -11,9 +11,17 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin')
const
OptimizeCSSPlugin
=
require
(
'optimize-css-assets-webpack-plugin'
)
const
OptimizeCSSPlugin
=
require
(
'optimize-css-assets-webpack-plugin'
)
const
UglifyJsPlugin
=
require
(
'uglifyjs-webpack-plugin'
)
const
UglifyJsPlugin
=
require
(
'uglifyjs-webpack-plugin'
)
const
BundleAnalyzerPlugin
=
require
(
'webpack-bundle-analyzer'
).
BundleAnalyzerPlugin
;
const
BundleAnalyzerPlugin
=
require
(
'webpack-bundle-analyzer'
).
BundleAnalyzerPlugin
;
const
env
=
process
.
env
.
NODE_ENV
===
'testing'
var
env
=
null
?
require
(
'../config/test.env'
)
if
(
process
.
env
.
NODE_ENV
===
'testing'
){
:
require
(
'../config/prod.env'
)
env
=
require
(
'../config/dev.env'
)
}
else
if
(
process
.
env
.
NODE_ENV
===
'pre'
){
env
=
require
(
'../config/test.env'
)
}
else
{
env
=
require
(
'../config/prod.env'
)
}
// const env = process.env.NODE_ENV === 'testing'
// ? require('../config/test.env')
// : require('../config/prod.env')
const
webpackConfig
=
merge
(
baseWebpackConfig
,
{
const
webpackConfig
=
merge
(
baseWebpackConfig
,
{
module
:
{
module
:
{
...
...
config/index.js
View file @
6c9b1f24
...
@@ -26,7 +26,7 @@ module.exports = {
...
@@ -26,7 +26,7 @@ module.exports = {
proxyTable
:
{
proxyTable
:
{
'/api'
:
{
'/api'
:
{
// target: 'http://10.1.23.103', // 接口的域名
// target: 'http://10.1.23.103', // 接口的域名
target
:
'https://wechat-
pre
.changchangenglish.com/'
,
target
:
'https://wechat-
test
.changchangenglish.com/'
,
changeOrigin
:
true
,
// 如果接口跨域,需要进行这个参数配置
changeOrigin
:
true
,
// 如果接口跨域,需要进行这个参数配置
}
}
},
},
...
@@ -51,9 +51,9 @@ module.exports = {
...
@@ -51,9 +51,9 @@ module.exports = {
},
},
build
:
{
build
:
{
// Template for index.html
// Template for index.html
index
:
process
.
env
.
NODE_ENV
===
'production'
?
path
.
resolve
(
__dirname
,
'../dist/index.html'
)
:
path
.
resolve
(
__dirname
,
'../pre
/index.html'
),
index
:
path
.
resolve
(
__dirname
,
'../dist
/index.html'
),
// Paths
// Paths
assetsRoot
:
process
.
env
.
NODE_ENV
===
'production'
?
path
.
resolve
(
__dirname
,
'../dist'
)
:
path
.
resolve
(
__dirname
,
'../pre
'
),
assetsRoot
:
path
.
resolve
(
__dirname
,
'../dist
'
),
assetsSubDirectory
:
'static'
,
assetsSubDirectory
:
'static'
,
assetsPublicPath
:
'/'
,
assetsPublicPath
:
'/'
,
...
...
config/pre.env.js
0 → 100644
View file @
6c9b1f24
'use strict'
;
module
.
exports
=
{
NODE_ENV
:
'"pre"'
,
IMAGE_URL_HEAD
:
'"https://cdn.singsingenglish.com/"'
,
API_URL
:
'"/"'
,
MAX_FILESIZE
:
'1024*1024*10'
,
SHOP_URL
:
'"https://w.url.cn/s/AX5b5QN"'
,
PERIODS_URL
:
'"https://w.url.cn/s/ARs9XI5"'
,
INVITE_URL
:
'"https://wechat-pre.changchangenglish.com/"'
,
}
config/test.env.js
View file @
6c9b1f24
'use strict'
;
'use strict'
;
module
.
exports
=
{
const
merge
=
require
(
'webpack-merge'
);
const
prodEnv
=
require
(
'./prod.env'
);
module
.
exports
=
merge
(
prodEnv
,
{
NODE_ENV
:
'"testing"'
,
NODE_ENV
:
'"testing"'
,
IMAGE_URL_HEAD
:
'"https://cdn.singsingenglish.com/"'
,
API_URL
:
'"/"'
,
API_URL
:
'"/"'
,
MAX_FILESIZE
:
'1024*1024*10'
,
MAX_FILESIZE
:
'1024*1024*10'
,
SHOP_URL
:
'"https://w.url.cn/s/AX5b5QN"'
,
SHOP_URL
:
'"https://w.url.cn/s/AX5b5QN"'
,
PERIODS_URL
:
'"https://w.url.cn/s/ARs9XI5"'
,
PERIODS_URL
:
'"https://w.url.cn/s/ARs9XI5"'
,
INVITE_URL
:
'"https://wechat-pre.changchangenglish.com/"'
,
IMAGE_URL_HEAD
:
'"https://cdn.singsingenglish.com/"'
,
}
INVITE_URL
:
'"https://wechat-test.changchangenglish.com/"'
,
});
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