renderer: simplify set static path in production
This commit is contained in:
1 parent
c9560b38f0
commit
89a65c9707
2 files changed
+4
-12
No files matched your search
@@ -105,8 +105,8 @@ export default {
|
||||
removeAttributeQuotes: true,
|
||||
removeComments: true
|
||||
},
|
||||
isBrowser: false,
|
||||
isDevelopment: IS_DEV_ENV,
|
||||
staticPath: path.join(__dirname, '/static').replace(/\\/g, '\\\\'),
|
||||
nodeModules: IS_DEV_ENV
|
||||
? path.resolve(__dirname, '../../node_modules')
|
||||
: false
|
||||
|
||||
+3
-11
@@ -3,21 +3,13 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Vutron</title>
|
||||
<% if (htmlWebpackPlugin.options.nodeModules) { %>
|
||||
<!-- Add `node_modules/` to global paths so `require` works properly in development -->
|
||||
<script>
|
||||
require('module').globalPaths.push('<%= htmlWebpackPlugin.options.nodeModules.replace(/\\/g, '\\\\') %>')
|
||||
</script>
|
||||
<% } %>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<!-- Set `__static` path to static files in production -->
|
||||
<% if (!htmlWebpackPlugin.options.isBrowser && !htmlWebpackPlugin.options.isDevelopment) { %>
|
||||
</body>
|
||||
<% if (!htmlWebpackPlugin.options.isDevelopment) { %>
|
||||
<script>
|
||||
window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
|
||||
window.__static = '<%= htmlWebpackPlugin.options.staticPath %>'
|
||||
</script>
|
||||
<% } %>
|
||||
<!-- webpack builds are automatically injected -->
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user