我用来构建我的应用程序的技术是React,Web-pack,Babel和AlT(flux实现)
当web pack尝试编译我的应用程序时,我收到错误.不确定我缺少哪些库.
有人可以请教吗?
##.babelrc file##
{"presets": ["react", "es2015", "stage-0"]}
Run Code Online (Sandbox Code Playgroud)
当我从终端运行'webpack-dev-server'时它运行正常:
$ webpack-dev-server
http://localhost:3333/
webpack result is served from /./assets/
content is served from C:\Users\Komo\Documents\work\training
Hash: e705c984af7e83cbb685
Version: webpack 1.12.9
Time: 8556ms
Asset Size Chunks Chunk Names
bundle.js 905 kB 0 [emitted] main
chunk {0} bundle.js (main) 855 kB [rendered]
...
webpack: bundle is now VALID.
Run Code Online (Sandbox Code Playgroud)
我正试图用gulp开始它:
这是我的gulpfile.js:
var gulp = require('gulp');
var gutil = require('gulp-util');
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var webpackConfig = require('./webpack.config.js');
gulp.task('webpack-dev-server', function (c) {
var myConfig = Object.create(webpackConfig);
myConfig.devtool = …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的webpack开发服务器中设置代理.问题是我不控制我正在连接的服务器,我需要验证请求.
有没有办法可以将cookie添加到我发送给代理服务器的请求中?我查看了webpack dev服务器代理服务器页面,以及它链接到的node-http-proxy页面,我没有看到任何cookie提及.我也不确定是否有办法让我看到这些转发的请求,所以我无法判断我正在尝试做什么.
有任何想法吗?
我正在运行我的webpack-dev-server
webpack-dev-server --lazy --inline --progress --colors --port 8082
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试访问时,我的浏览器显示404错误bundle.js.
一切似乎罚款,因为如果我更换--lazy用--hot,事情做工精细.
究竟做了--lazy什么呢?
更新:
这是webpack文件 -
module.exports = {
devtool: "source-map",
entry: [
'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors
"./app/main.js"
],
output: {
path: "./js",
filename: "bundle.js"
},
module: {
loaders: [
{ test: /\.css$/, loader: "style-loader!css-loader"},
{ test: /\.js$/, exclude: /node_modules/, loaders: ["react-hot"] }
]
}
};
Run Code Online (Sandbox Code Playgroud) chrome控制台错误:未捕获ReferenceError:未定义__decorate这是代码https://github.com/Dreampie/angular2-demo
运行:
npm安装
npm run typings install
npm跑步开始
在浏览器中打开localhost:80
有人帮忙吗?
我已经创建了一个docker镜像,它使用容器内部的webpack来提供简单的反应应用程序,但我在浏览器中什么也得不到.
这是我的配置文件
package.json
{
"name": "invas_client",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack --inline --content-base ."
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^0.14.7",
"react-dom": "^0.14.7",
"react-router": "^2.0.0"
},
"devDependencies": {
"babel-core": "^6.5.1",
"babel-loader": "^6.2.2",
"babel-preset-es2015": "^6.5.0",
"babel-preset-react": "^6.5.0",
"http-server": "^0.8.5",
"webpack": "^1.12.13",
"webpack-dev-server": "^1.14.1"
}
}
Run Code Online (Sandbox Code Playgroud)
webpack.config.js
module.exports = {
entry: './index.js',
output: {
filename: 'bundle.js',
publicPath: ''
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?presets[]=es2015&presets[]=react' }
]
}
}
Run Code Online (Sandbox Code Playgroud)
Dockerfile …
我有一个简单的React JS项目,我正在部署到OSE中.我也在我的项目中使用以下依赖项.
"webpack": "^2.2.0",
"webpack-dev-server": "^1.14.1",
"react": "^15.5.4",
"react-router-dom": "^4.1.1"
Run Code Online (Sandbox Code Playgroud)
我也通过下面的构建脚本运行我的项目.
"build": "SET NODE_ENV=production && webpack-dev-server --host 0.0.0.0 --inline --history-api-fallback --content-base . "
Run Code Online (Sandbox Code Playgroud)
在OSE中一切顺利,Webpack成功编译.但在访问网址时,它会在网页上显示"无效的主机标头".
任何人都可以帮忙.React中有些新东西.
提前致谢.
webpack-serve:https://github.com/webpack-contrib/webpack-serve
webpack-dev-server:https://github.com/webpack/webpack-dev-server
他们都说他们是webpack的开发服务器.他们有什么不同?
我按照关于 pluralsight 的教程使用 gitbash 通过 github 克隆了这个 Webpack Starter 包。我正在尝试通过 Visual Studio Code 的集成终端访问 webpack,但出现以下错误。我是新手,所以请帮助我。
我正在运行命令
Raza Zaidi@RazaZaidi-PC MINGW64 ~/webpack-starter (master)
$ npm run dev
Run Code Online (Sandbox Code Playgroud)
然后发生以下错误
> yet-another-webpack-es6-starterkit@1.0.0 dev C:\Users\Raza Zaidi\webpack-starter
> webpack-dev-server --open --config webpack/webpack.config.dev.js
'webpack-dev-server' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! yet-another-webpack-es6-starterkit@1.0.0 dev: `webpack-dev-server --open --config webpack/webpack.config.dev.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the yet-another-webpack-es6-starterkit@1.0.0 …Run Code Online (Sandbox Code Playgroud) 我正在写一个webpack-react-typescript工具包,我发现源映射不能直接指向源代码,它直接指向source-map,这个文件有一些webpack注入代码.但是另一台计算机同时具有域webpack-internal://src/App.tsx file和webpack://域,以及webpack-internal域中可以指向当前源代码的源映射.所以我想知道的是:
1.什么是之间的不同webpack://和webpack
2.为什么有些电脑必须webpack-internal和somecomputer都没有了吗?
webpack ×10
reactjs ×3
angular ×1
babeljs ×1
cookies ×1
deployment ×1
docker ×1
gulp ×1
javascript ×1
node.js ×1
npm ×1
proxy ×1
react-alt ×1
react-router ×1
typescript ×1