project is a
npm run dev generated using vue-cli that can be accessed normally.
npm run build reported an error. The error message is as follows
building for production.Error processing file:
static/css/app.104df4065122c4f2c7a136e88a4e9c00.css (node:2780)
UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token in
JSON at position 111054at JSON.parse (<anonymous>) at new SourceMapConsumer (F:\work\ror\test\buefy-sample\node_modules\_source-map@0.5.7@source-map\lib\source-map-consumer.js:17:22) at PreviousMap.consumer (F:\work\ror\test\buefy-sample\node_modules\_postcss@5.2.18@postcss\lib\previous-map.js:69:34) at new Input (F:\work\ror\test\buefy-sample\node_modules\_postcss@5.2.18@postcss\lib\input.js:84:28) at parse (F:\work\ror\test\buefy-sample\node_modules\_postcss@5.2.18@postcss\lib\parse.js:21:17) at new LazyResult (F:\work\ror\test\buefy-sample\node_modules\_postcss@5.2.18@postcss\lib\lazy-result.js:70:24) at Processor.process (F:\work\ror\test\buefy-sample\node_modules\_postcss@5.2.18@postcss\lib\processor.js:117:12) at Function.cssnano.process (F:\work\ror\test\buefy-sample\node_modules\_cssnano@3.10.0@cssnano\dist\index.js:306:55) at OptimizeCssAssetsPlugin.processCss (F:\work\ror\test\buefy-sample\node_modules\_optimize-css-assets-webpack-plugin@3.2.0@optimize-css-assets-webpack-plugin\index.js:63:19) at Object.processor (F:\work\ror\test\buefy-sample\node_modules\_optimize-css-assets-webpack-plugin@3.2.0@optimize-css-assets-webpack-plugin\index.js:29:23) at F:\work\ror\test\buefy-sample\node_modules\_last-call-webpack-plugin@2.1.2@last-call-webpack-plugin\index.js:139:8 at arrayEach (F:\work\ror\test\buefy-sample\node_modules\_lodash@4.17.5@lodash\_arrayEach.js:15:9) at forEach (F:\work\ror\test\buefy-sample\node_modules\_lodash@4.17.5@lodash\forEach.js:38:10) at LastCallWebpackPlugin.process (F:\work\ror\test\buefy-sample\node_modules\_last-call-webpack-plugin@2.1.2@last-call-webpack-plugin\index.js:136:3) at Compilation.<anonymous> (F:\work\ror\test\buefy-sample\node_modules\_last-call-webpack-plugin@2.1.2@last-call-webpack-plugin\index.js:194:12) at next (F:\work\ror\test\buefy-sample\node_modules\_tapable@0.2.8@tapable\lib\Tapable.js:204:14)
(node:2780) UnhandledPromiseRejectionWarning: Unhandled promise
rejection. This error originated either by throwing inside of an async
function without a catch block, or by rejecting a promise which was
not handled with .catch (). (rejection id: 2) (node:2780) [DEP0018]
DeprecationWarning: Unhandled promise rejections are deprecated. In
the future, promise rejections that are not handled will terminate the
Node.js process with a non-zero exit code.
webpack.base.conf.js is as follows
"use strict"
const path = require("path")
const utils = require("./utils")
const config = require("../config")
const vueLoaderConfig = require("./vue-loader.conf")
require("babel-polyfill")
function resolve (dir) {
return path.join(__dirname, "..", dir)
}
module.exports = {
context: path.resolve(__dirname, "../"),
entry: {
app: ["babel-polyfill", "./src/main.js"],
},
output: {
path: config.build.assetsRoot,
filename: "[name].js",
publicPath: process.env.NODE_ENV === "production"
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: [".js", ".vue", ".json"],
alias: {
"vue$": "vue/dist/vue.esm.js",
"@": resolve("src"),
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: "vue-loader",
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: "babel-loader",
include: [resolve("src"), resolve("test"), resolve("node_modules/webpack-dev-server/client")]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: "url-loader",
options: {
limit: 10000,
name: utils.assetsPath("img/[name].[hash:7].[ext]")
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: "url-loader",
options: {
limit: 10000,
name: utils.assetsPath("media/[name].[hash:7].[ext]")
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: "url-loader",
options: {
limit: 10000,
name: utils.assetsPath("fonts/[name].[hash:7].[ext]")
}
}
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it"s native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: "empty",
fs: "empty",
net: "empty",
tls: "empty",
child_process: "empty"
}
}
package.json
{
"name": "buefy-sample",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "*****",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"build": "node build/build.js"
},
"dependencies": {
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"buefy": "^0.6.5",
"bulma": "^0.7.1",
"mdi": "^2.2.43",
"vue": "^2.5.2",
"vue-i18n": "^7.6.0",
"vue-router": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"chalk": "^2.0.1",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
main.js
import Vue from "vue";
import VueRouter from "vue-router";
import App from "./App";
import Buefy from "buefy";
import "buefy/lib/buefy.css";
import "bulma/css/bulma.css";
import routes from "./config/routers.js";
import "./assets/css/style.css";
import "mdi/css/materialdesignicons.css";
import VueI18n from "vue-i18n";
Vue.use(VueI18n);
Vue.use(VueRouter);
Vue.use(Buefy);
Vue.config.productionTip = false;