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,
|
removeAttributeQuotes: true,
|
||||||
removeComments: true
|
removeComments: true
|
||||||
},
|
},
|
||||||
isBrowser: false,
|
|
||||||
isDevelopment: IS_DEV_ENV,
|
isDevelopment: IS_DEV_ENV,
|
||||||
|
staticPath: path.join(__dirname, '/static').replace(/\\/g, '\\\\'),
|
||||||
nodeModules: IS_DEV_ENV
|
nodeModules: IS_DEV_ENV
|
||||||
? path.resolve(__dirname, '../../node_modules')
|
? path.resolve(__dirname, '../../node_modules')
|
||||||
: false
|
: false
|
||||||
|
|||||||
+3
-11
@@ -3,21 +3,13 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Vutron</title>
|
<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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<!-- Set `__static` path to static files in production -->
|
</body>
|
||||||
<% if (!htmlWebpackPlugin.options.isBrowser && !htmlWebpackPlugin.options.isDevelopment) { %>
|
<% if (!htmlWebpackPlugin.options.isDevelopment) { %>
|
||||||
<script>
|
<script>
|
||||||
window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
|
window.__static = '<%= htmlWebpackPlugin.options.staticPath %>'
|
||||||
</script>
|
</script>
|
||||||
<% } %>
|
<% } %>
|
||||||
<!-- webpack builds are automatically injected -->
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
Reference in new issue
Block a user