-
It seem like the ...
"alias": {
"vue": "./node_modules/vue/dist/vue.common.js"
}
... my 'use strict'
const Bundler = require('parcel-bundler')
const path = require('path')
const isProd = process.env.NODE_ENV === 'production'
const entryFiles = path.join(__dirname, './src/index.html');
const options = {
outDir: './dist', // The out directory to put the build files in, defaults to dist
outFile: 'index.html', // The name of the outputFile
publicUrl: '/', // The url to serve on, defaults to '/'
watch: true, // Whether to watch the files and rebuild them on change, defaults to process.env.NODE_ENV !== 'production'
cache: true, // Enabled or disables caching, defaults to true
cacheDir: '.cache', // The directory cache gets put in, defaults to .cache
contentHash: false, // Disable content hash from being included on the filename
global: 'bundle', // Expose modules as UMD under this name, disabled by default
minify: false, // Minify files, enabled if process.env.NODE_ENV === 'production'
scopeHoist: false, // Turn on experimental scope hoisting/tree shaking flag, for smaller production bundles
target: 'browser', // Browser/node/electron, defaults to browser
// By default, package.json dependencies are not included when using 'node' or 'electron' with 'target' option above.
// Set to true to adds them to the bundle, false by default
bundleNodeModules: false,
// https: { // Define a custom {key, cert} pair, use true to generate one or false to use http
// cert: './ssl/c.crt', // Path to custom certificate
// key: './ssl/k.key' // Path to custom key
// },
// 5 = save everything to a file, 4 = like 3, but with timestamps and additionally log http requests to dev server,
// 3 = log info, warnings & errors, 2 = log warnings & errors, 1 = log errors, 0 = log nothing
logLevel: 3,
hmr: true, // Enable or disable HMR while watching
hmrPort: 0, // The port the HMR socket runs on, defaults to a random free port (0 in node.js resolves to a random free port)
sourceMaps: true, // Enable or disable sourcemaps, defaults to enabled (minified builds currently always create sourcemaps)
hmrHostname: '', // A hostname for hot module reload, default to ''
// Prints a detailed report of the bundles, assets, filesizes and times, defaults to false, reports are only printed if watch is disabled
detailedReport: false,
autoInstall: true // Enable or disable auto install of missing dependencies found during bundling
};
// option change using process.env.NODE_ENV
if (isProd) {
Object.assign(options, {
cache: true,
minify: true,
sourceMaps: false,
http: true
})
}
module.exports = new Bundler(entryFiles, options) my const serve = require('browser-sync')
const httpProxyMiddleware = require('http-proxy-middleware');
const bundler = require('./bundler')
const PORT = 8080
serve({
port: PORT,
open: true,
server: {
baseDir: './dist'
},
middleware: [
httpProxyMiddleware('/api', { target: 'http://locahost:3000' }),
bundler.middleware()
]
}, (err) => {
if (!err) {
console.log('\033[1mServer running at \u001b[36mhttp://localhost:' + PORT +'\033[0m');
} else {
throw err
}
}) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
solved by changing |
Beta Was this translation helpful? Give feedback.
-
Looks like the same problem here #4437 I think I'm running into this as well |
Beta Was this translation helpful? Give feedback.
solved by changing
bundleNodeModules
totrue