Set public path to work in dev and prod
This commit is contained in:
parent
889093011e
commit
975b1f4f66
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Three.js Webpack ES6 Boilerplate</title>
|
||||
<script defer src="js/runtime.bundle.js"></script><script defer src="js/vendors.bundle.js"></script><script defer src="js/main.bundle.js"></script><link href="js/../css/main.css" rel="stylesheet"></head>
|
||||
<script defer src="/js/runtime.bundle.js"></script><script defer src="/js/vendors.bundle.js"></script><script defer src="/js/main.bundle.js"></script><link href="/js/../css/main.css" rel="stylesheet"></head>
|
||||
|
||||
<body>
|
||||
<section id="appContainer" class="main">
|
||||
|
|
|
@ -12,6 +12,7 @@ const includePath = path.join(__dirname, 'src/js');
|
|||
const nodeModulesPath = path.join(__dirname, 'node_modules');
|
||||
|
||||
let outputPath = path.join(__dirname, 'src/public/js');
|
||||
let publicPath = '/js/';
|
||||
|
||||
module.exports = env => {
|
||||
// Dev environment
|
||||
|
@ -30,6 +31,7 @@ module.exports = env => {
|
|||
mode = 'production';
|
||||
stats = 'none';
|
||||
outputPath = `${__dirname}/build/js`;
|
||||
publicPath = 'js/';
|
||||
}
|
||||
|
||||
console.log('Webpack build -');
|
||||
|
@ -51,8 +53,7 @@ module.exports = env => {
|
|||
// must be an absolute path (use the Node.js path module)
|
||||
path: outputPath,
|
||||
// the url to the output directory resolved relative to the HTML page
|
||||
// should include at least trailing slash
|
||||
publicPath: '/js/',
|
||||
publicPath,
|
||||
// the filename template for entry chunks
|
||||
filename: '[name].bundle.js',
|
||||
chunkFilename: '[name].bundle.js',
|
||||
|
|
Loading…
Reference in New Issue