Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
visualcloud
/
Vmatrix-template
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d4ee03d2
authored
Sep 07, 2019
by
hank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资源路径
parent
42433693
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
50 deletions
+62
-50
build/utils.js
+12
-4
build/vue-loader.conf.js
+0
-1
build/webpack.base.conf.js
+44
-39
build/webpack.prod.conf.js
+3
-4
config/index.js
+3
-2
No files found.
build/utils.js
View file @
d4ee03d2
...
...
@@ -15,11 +15,12 @@ exports.assetsPath = function (_path) {
exports
.
cssLoaders
=
function
(
options
)
{
options
=
options
||
{}
// console.log(options)
const
cssLoader
=
{
loader
:
'css-loader'
,
options
:
{
sourceMap
:
options
.
sourceMap
sourceMap
:
options
.
sourceMap
,
publicPath
:
'../../'
}
}
...
...
@@ -33,12 +34,13 @@ exports.cssLoaders = function (options) {
// generate loader string to be used with extract text plugin
function
generateLoaders
(
loader
,
loaderOptions
)
{
const
loaders
=
options
.
usePostCSS
?
[
cssLoader
,
postcssLoader
]
:
[
cssLoader
]
// console.log('aaaa')
if
(
loader
)
{
loaders
.
push
({
loader
:
loader
+
'-loader'
,
options
:
Object
.
assign
({},
loaderOptions
,
{
sourceMap
:
options
.
sourceMap
sourceMap
:
options
.
sourceMap
,
publicPath
:
'.../../'
})
})
}
...
...
@@ -46,7 +48,13 @@ exports.cssLoaders = function (options) {
// Extract CSS when that option is specified
// (which is the case during production build)
if
(
options
.
extract
)
{
// console.log(MiniCssExtractPlugin.loader)
return
[
MiniCssExtractPlugin
.
loader
].
concat
(
loaders
)
// return ExtractTextPlugin.extract({
// use: loaders,
// fallback: 'vue-style-loader',
// publicPath: '../../'
// })
}
else
{
return
[
'vue-style-loader'
].
concat
(
loaders
)
}
...
...
build/vue-loader.conf.js
View file @
d4ee03d2
...
...
@@ -5,7 +5,6 @@ const isProduction = process.env.NODE_ENV === 'production'
const
sourceMapEnabled
=
isProduction
?
config
.
build
.
productionSourceMap
:
config
.
dev
.
cssSourceMap
module
.
exports
=
{
loaders
:
utils
.
cssLoaders
({
sourceMap
:
sourceMapEnabled
,
...
...
build/webpack.base.conf.js
View file @
d4ee03d2
'use strict'
const
path
=
require
(
'path'
)
const
utils
=
require
(
'./utils'
)
const
config
=
require
(
'../config'
)
const
vueLoaderConfig
=
require
(
'./vue-loader.conf'
)
"use strict"
;
const
path
=
require
(
"path"
);
const
utils
=
require
(
"./utils"
);
const
config
=
require
(
"../config"
);
const
vueLoaderConfig
=
require
(
"./vue-loader.conf"
);
// const MiniCssExtractPlugin = require("mini-css-extract-plugin");
function
resolve
(
dir
)
{
return
path
.
join
(
__dirname
,
'..'
,
dir
)
return
path
.
join
(
__dirname
,
".."
,
dir
);
}
const
createLintingRule
=
()
=>
({
test
:
/
\.(
js|vue
)
$/
,
loader
:
'eslint-loader'
,
enforce
:
'pre'
,
include
:
[
resolve
(
'src'
),
resolve
(
'test'
)],
loader
:
"eslint-loader"
,
enforce
:
"pre"
,
include
:
[
resolve
(
"src"
),
resolve
(
"test"
)],
options
:
{
formatter
:
require
(
'eslint-friendly-formatter'
),
formatter
:
require
(
"eslint-friendly-formatter"
),
emitWarning
:
!
config
.
dev
.
showEslintErrorsInOverlay
}
})
})
;
module
.
exports
=
{
context
:
path
.
resolve
(
__dirname
,
'../'
),
context
:
path
.
resolve
(
__dirname
,
"../"
),
entry
:
{
app
:
'./src/main.js'
app
:
"./src/main.js"
},
output
:
{
path
:
config
.
build
.
assetsRoot
,
filename
:
'[name].js'
,
publicPath
:
process
.
env
.
NODE_ENV
===
'production'
filename
:
"[name].js"
,
publicPath
:
process
.
env
.
NODE_ENV
===
"production"
?
config
.
build
.
assetsPublicPath
:
config
.
dev
.
assetsPublicPath
},
resolve
:
{
extensions
:
[
'.js'
,
'.vue'
,
'.json'
],
extensions
:
[
".js"
,
".vue"
,
".json"
],
alias
:
{
'vue$'
:
'vue/dist/vue.esm.js'
,
'@'
:
resolve
(
'src'
),
'src'
:
resolve
(
'src'
)
vue
$
:
"vue/dist/vue.esm.js"
,
"@"
:
resolve
(
"src"
),
src
:
resolve
(
"src"
)
}
},
module
:
{
...
...
@@ -43,46 +45,49 @@ module.exports = {
// ...(config.dev.useEslint ? [createLintingRule()] : []),
{
test
:
/
\.
vue$/
,
loader
:
'vue-loader'
,
loader
:
"vue-loader"
,
options
:
vueLoaderConfig
},
{
test
:
/
\.
js$/
,
loader
:
'babel-loader'
,
include
:
[
resolve
(
'src'
),
resolve
(
'test'
),
resolve
(
'node_modules/webpack-dev-server/client'
)]
loader
:
"babel-loader"
,
include
:
[
resolve
(
"src"
),
resolve
(
"test"
),
resolve
(
"node_modules/webpack-dev-server/client"
)
]
},
{
test
:
/
\.
svg$/
,
loader
:
'svg-sprite-loader'
,
exclude
:
path
.
resolve
(
__dirname
,
'./src/assets/icons'
),
include
:
[
resolve
(
'src/icons'
)],
loader
:
"svg-sprite-loader"
,
exclude
:
path
.
resolve
(
__dirname
,
"./src/assets/icons"
),
include
:
[
resolve
(
"src/icons"
)],
options
:
{
symbolId
:
'icon-[name]'
symbolId
:
"icon-[name]"
}
},
{
test
:
/
\.(
png|jpe
?
g|gif
)(\?
.*
)?
$/
,
loader
:
'url-loader'
,
loader
:
"url-loader"
,
options
:
{
limit
:
10000
,
name
:
utils
.
assetsPath
(
'img/[name].[hash:7].[ext]'
)
name
:
utils
.
assetsPath
(
"img/[name].[hash:7].[ext]"
)
}
},
{
test
:
/
\.(
mp4|webm|ogg|mp3|wav|flac|aac
)(\?
.*
)?
$/
,
loader
:
'url-loader'
,
loader
:
"url-loader"
,
options
:
{
limit
:
10000
,
name
:
utils
.
assetsPath
(
'media/[name].[hash:7].[ext]'
)
name
:
utils
.
assetsPath
(
"media/[name].[hash:7].[ext]"
)
}
},
{
test
:
/
\.(
woff2
?
|eot|ttf|otf
)(\?
.*
)?
$/
,
loader
:
'url-loader'
,
loader
:
"url-loader"
,
options
:
{
limit
:
10000
,
name
:
utils
.
assetsPath
(
'fonts/[name].[hash:7].[ext]'
)
name
:
utils
.
assetsPath
(
"fonts/[name].[hash:7].[ext]"
)
}
}
]
...
...
@@ -93,10 +98,10 @@ module.exports = {
setImmediate
:
false
,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram
:
'empty'
,
fs
:
'empty'
,
net
:
'empty'
,
tls
:
'empty'
,
child_process
:
'empty'
dgram
:
"empty"
,
fs
:
"empty"
,
net
:
"empty"
,
tls
:
"empty"
,
child_process
:
"empty"
}
}
}
;
build/webpack.prod.conf.js
View file @
d4ee03d2
...
...
@@ -20,7 +20,8 @@ const env =
// console.log(webpack.optimize);
const
webpackConfig
=
merge
(
baseWebpackConfig
,
{
module
:
{
rules
:
utils
.
styleLoaders
({
rules
:
utils
.
styleLoaders
({
sourceMap
:
config
.
build
.
productionSourceMap
,
extract
:
true
,
usePostCSS
:
true
...
...
@@ -60,9 +61,7 @@ const webpackConfig = merge(baseWebpackConfig, {
"process.env"
:
env
}),
new
WriteJsonPlugin
({
object
:
{
},
object
:
{},
path
:
""
,
// default output is timestamp.json
filename
:
"data.json"
,
...
...
config/index.js
View file @
d4ee03d2
...
...
@@ -49,8 +49,9 @@ module.exports = {
// Paths
assetsRoot
:
path
.
resolve
(
__dirname
,
'../dist'
),
assetsSubDirectory
:
'static'
,
assetsSubDirectory
:
'
../../
static'
,
assetsPublicPath
:
'./'
,
publicPath
:
'../../'
,
/**
* Source Maps
...
...
@@ -59,7 +60,7 @@ module.exports = {
productionSourceMap
:
false
,
// https://webpack.js.org/configuration/devtool/#production
devtool
:
'#source-map'
,
inlineSource
:
tru
e
,
inlineSource
:
fals
e
,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
...
...
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