webpack-dev-server

webpack

僤鯓⒐⒋嵵緔 提交于 2019-12-04 03:38:14
请参考右边网页的 Installation 和 Getting Started 篇: https://webpack.js.org/guides/ 安装webpack 先使用 git bash 进入一个你想安装的位置,然后请在 git bash 里输入如下命令,该命令将下载最新版本的 webpack 。 cd //这里填写你想安装的位置 npm install --save-dev webpack webpack 安装成功及文件夹中新增文件如下二图: 新建信息文件package.json webpack 安装成功后,如果想在目录下新建一个 webpack 相关的信息文件,请使用下面命令: npm init -y 信息文件 package.json 新建成功及文件夹中新增文件如下二图: 加载Lodash 方法1 首先,修改文件夹结构,添加下图中没有的文件夹和文件: node_modules 、 package-lock.json 是下载 webpack 产生的文件 package.json 是 webpack 相关的信息文件,现在需要修改 私密性 + "private": true, //前面加号表示请 添加 这行 - "main": "index.js", //前面减号表示请 删除 这行 添加 index.html <!doctype html> <html> <head>

webpack bundle.js not found

元气小坏坏 提交于 2019-12-04 03:31:42
问题 I use webpack dev server, but can't access my bundle.js file. Edit: I am using this webpack config without bower-webpack-plugin . package.json { "name": "react_modules", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "start": "npm run serve | npm run dev", "serve": "./node_modules/.bin/http-server -p 8080", "dev": "webpack-dev-server -d --progress --colors --port 8090" }, "author": "", "license": "ISC", "devDependencies": { "babel-core": "^6.0.20", "babel-loader": "^6

Authorization header doesn't get sent in cross-origin request

寵の児 提交于 2019-12-04 02:44:55
问题 Solution at the END. My server was my problem... Shortly solution, I need to use express cors Original POST: First of ALL: I have add Access-Control-Allow-Origin, Access-Control-Allow-Headers and i can access the server, but, i can't send data in the Header to the server. So: I am developing basically with Vue.js (with webpack to hot reload changes) and Express (with nodemon). So I have 2 separated servers: First: backend (server) running at: http://localhost:3000 with nodemon Second:

React-Style, Webpack, React - Uncaught Error: Invariant Violation: The `style` prop

时间秒杀一切 提交于 2019-12-04 00:29:36
问题 I'm getting the following error in my browser: Uncaught Error: Invariant Violation: The style prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX. This is when running webpack-dev-server and going to localhost:8080. ./modules/main.js: /** @jsx React.DOM */ var React = require('react'); var HoverAction = require('./HoverAction/HoverAction'); var Application = React.createClass({ render: function() { return (

WebPack sourcemaps confusing (duplicated files)

筅森魡賤 提交于 2019-12-04 00:23:39
I decided to try out WebPack on a new project I'm spinning up today and I'm getting really strange behavior from the sourcemaps. I can't find anything about it in the documentation, nor can I find anyone else having this issue when skimming StackOverflow. I'm currently looking at the HelloWorld app produced by Vue-CLI's WebPack template -- no changes have been made to the code, the build environment, or anything. I installed everything and ran it like so: vue init webpack test && cd test && npm install && npm run dev Looking at my sourcemaps, I see the following: This is a hot mess. Why are

webpack+angular2 error: Uncaught ReferenceError: __decorate is not defined

半世苍凉 提交于 2019-12-03 23:32:15
chrome console error: Uncaught ReferenceError: __decorate is not defined this is code https://github.com/Dreampie/angular2-demo run it: npm install npm run typings install npm run start open localhost:80 in browser someone help? remove from tsconfig.json "declaration": true, "noEmitHelpers": false, "isolatedModules": false 来源: https://stackoverflow.com/questions/36808303/webpackangular2-error-uncaught-referenceerror-decorate-is-not-defined

vue-loader@15.x VueLoaderPlugin 记录一下

♀尐吖头ヾ 提交于 2019-12-03 21:52:38
报错:==vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.== 目前, //两个方式都可以的,随便用一个 const VueLoaderPlugin = require ( 'vue-loader/lib/plugin' ); // 或者 const { VueLoaderPlugin } = require ( 'vue-loader' ) plugins: [ // make sure to include the plugin for the magic new VueLoaderPlugin() ] 问题描述: 基本上,加上这样上面这些都是没问题的。但还是会报错,原因在于下面这段代码, 可以看到,加入了 resolveLoader 之后,所有 rules 下的 loader 配置都没有直接跟随后缀 -loader ,导致一直再报各种各样的错误信息! module : { rules : [{ test: /\.js$/, loader: 'babel' , }, { test : /\.vue$/, loader: 'vue' , }, { test : /\.(css|less)$/,

webpack.validateSchema is not a function

时间秒杀一切 提交于 2019-12-03 18:32:18
问题 Webpack are throwing this error all of a sudden: TypeError: webpack.validateSchema is not a function Everything was working fine Friday, not working today. No new commits to master since Friday. Pruned NPM, that didn't work, deleted NPM folder and re-installed, no dice. Checked out to previous branches which have not been rebased from Master for over a week. Still the same. Anyone have an idea? 回答1: Looks like npm bug, since webpack-dev-server@2.1.0-beta.11 requires webpack@^2.1.0-beta.26 but

Proxy requests to a separate backend server with vue-cli

断了今生、忘了曾经 提交于 2019-12-03 18:30:13
问题 I am using vue-cli webpack-simple template to generate my projects, and I'd like to proxy requests to a separate, backend server. How can this be easily achieved? 回答1: If you use webpack template with vue-cli , then you can find the required information in this reference document: http://vuejs-templates.github.io/webpack/proxy.html Or instead of changing your template now, you may copy the relevant config from the webpack template into your local webpack-simple template. EDIT: more info from

CORS error even after setting Access-Control-Allow-Origin on client side

浪尽此生 提交于 2019-12-03 17:20:33
问题 I have a Vue application generated with webpack-simple option. I am trying to make a GET request to https://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en but I get the error: XMLHttpRequest cannot load https://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en . Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://127.0.0.1:8080 ' is therefore not allowed