-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.mix.js
66 lines (59 loc) · 1.29 KB
/
webpack.mix.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const mix = require('laravel-mix')
// 获取开发环境所需的端口配置
const envConfig = require('dotenv').config()
envConfig.parsed = envConfig.parsed || {}
const WEB_PORT = envConfig.parsed.WEB_PORT || '8888'
const DEV_PORT = envConfig.parsed.DEV_PORT || '3098'
mix.disableNotifications()
mix.options({
uglify: {
uglifyOptions: {
ie8: true,
},
},
autoprefixer: {
options: {
browsers: [
'Android >= 5',
'iOS >= 10',
'Chrome >= 35',
'Firefox >= 56',
'Safari >= 11',
'Explorer >= 11',
],
},
},
processCssUrls: false,
})
if (process.env.MIX_MODE === 'watch') {
// static web server
const express = require('express')
const app = express()
app.use(express.static('./'))
app.get('/', function (req, res) {
res.redirect('/demo/')
})
app.listen(WEB_PORT, function () {
console.log(`[Nasa.js] Static web server running on port ${WEB_PORT}!\n`)
})
mix.browserSync({
proxy: 'localhost:' + WEB_PORT,
port: DEV_PORT,
ui: false,
ghostMode: false,
logLevel: 'debug',
files: [
'./demo/*.html',
'./demo/*.css',
'./demo/*.js',
'./dist/**/*.js',
'./.tmp/nasa*.js',
],
// notify: false,
browser: [],
})
}
// tasks - js
mix.js('./src/index.js', './.tmp/nasa-raw.js')
// task - demo - css
mix.stylus('./demo/src/index.styl', './demo/')