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