Tag: webpack

Webpack错误:TypeError:对象原型可能只是一个Object或null:undefined

我有一个使用webpack的angular度4应用程序。 当我尝试在我的亚马逊服务器运行我得到这个错误。 在我的地方工作很好。 任何想法为什么发生这种情况? 非常感谢你的帮助。

Webpack在Node.js App中打破摩卡

我有一个使用Mocha和Expect进行testing的node.js应用程序。 所有的testing工作很好,直到我安装了webpack的反应。 现在当我运行“npmtesting”时,出现以下错误: Error: Cannot find module 'should' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object.<anonymous> (C:\Users\Brian\version-control\tysons-tech-map-redone\node_modules\watchpack\test\DirectoryWatcher.test.js:2:1) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at C:\Users\Brian\version-control\tysons-tech-map-redone\node_modules\mocha\lib\mocha.js:230:27 at Array.forEach (native) at Mocha.loadFiles (C:\Users\Brian\version-control\tysons-tech-map-redone\node_modules\mocha\lib\mocha.js:227:14) at Mocha.run (C:\Users\Brian\version-control\tysons-tech-map-redone\node_modules\mocha\lib\mocha.js:495:10) […]

使用react-hot-loader v3和webpack-hot-middleware时,error development没有定义错误

鉴于这些是我正在使用的依赖关系: "react-hot-loader": "3.0.0-beta.7", "webpack": "2.6.1", "webpack-dev-middleware": "^1.11.0", "webpack-hot-middleware": "^2.18.1", "webpack-merge": "^4.1.0" 错误 patch.js:5 Uncaught ReferenceError: development is not defined at Object.defineProperty.value (patch.js:5) at __webpack_require__ (bootstrap 921586e…:659) at fn (bootstrap 921586e…:85) at Object.options.path (patch.js:1) at __webpack_require__ (bootstrap 921586e…:659) at fn (bootstrap 921586e…:85) at Object.<anonymous> (process-update.js:132) at __webpack_require__ (bootstrap 921586e…:659) at validateFormat (bootstrap 921586e…:708) at bootstrap 921586e…:708 […]

Webpack-dev-server和isomorphic react-node应用程序

我设法正确使用webpack开发服务器和一个节点服务器(express),使用webpackconfiguration中的插件部分。 这一切工作正常,但现在我试图去同构,并在快速应用程序内使用客户端组件。 到目前为止唯一的问题,我遇到的是,没有webpack“parsing”我的服务器端代码,我得到的情况下,我需要的组件,但path没有解决 IE 在组件内部 'use strict'; import React from 'react'; import { RouteHandler, Link } from 'react-router'; import Header from 'components/header/main'; // <– This line causes the error because webpack is not working when parsing this JSX server-side export default React.createClass({ displayName: 'App', render() { return ( // … More code 我应该以另一种方式configurationwebpack,还是必须将所有导入更改为有效的服务器端? 代码是这里万一你想看到实际的状态https://github.com/vshjxyz/es6-react-flux-node-quickstart

你仍然可以使用PHP作为后端angularjs2没有nodejs实时应用程序?

我不得不承认,我对angularjs2还是一个新的东西,不过,我想确保自己正在追求正确的道路,然后深入挖掘。 我不知道是否仍然可以使用PHP服务器作为angularjs2的后端? 因为我仍然不明白webpack是如何工作的,以及只为应用程序提供服务的想法,就像在服务器上提供服务一样,或者只是在构build过程中才提供服​​务。 因为它似乎只适用于一个index.js文件…我们仍然能够使用index.html作为编译的代码基础索引文件,并能够仍然使用PHP与js没有nodejs在活的应用程序?

获取“TypeError:调用`npm start`时无法读取未定义的属性”文件名“

我正在关注这个相当冗长但非常丰富的post,关于使用以下技术堆栈设置Web应用程序: es 6 节点+expression 车把 反应+反应路由器 webpack + babel 示例代码可以在这里find。 我一直在跟着,一切都很顺利,我理解了最重要的概念。 但是,当我尝试运行它时(使用git clone下载之后)出现错误,如下所示: $ npm install $ npm start 生成的输出包括错误是: > react-ssr-example@0.0.1 start /Users/nburk/Developer/node/templates/react-universal-web-apps-simple > npm-run-all –parallel gulp server > react-ssr-example@0.0.1 server /Users/nburk/Developer/node/templates/react-universal-web-apps-simple > node-dev app/babel-server.js > react-ssr-example@0.0.1 gulp /Users/nburk/Developer/node/templates/react-universal-web-apps-simple > gulp [19:10:39] Using gulpfile ~/Developer/node/templates/react-universal-web-apps-simple/gulpfile.js [19:10:39] Starting 'build:scss'… [19:10:39] Starting 'build:watch:app'… TypeError: Cannot read […]

Webpack构build成功,但是npm webpack没有构build输出

在命令提示符下,如果我inputwebpack然后回车,输出entry.min.js就可以正确的生成了。 但是,如果我inputnpm build并按回车,则不会生成任何内容。 我的package.json或webpack.config.js有什么问题吗? 顺便说一句,有没有办法生成一个捆绑的&缩小的CSS而不是一个JS文件? 因为input是一个CSS文件,但它给了我一个JS文件。 的package.json { "name": "assets", "version": "0.1.0", "description": "Front End Assets", "scripts": { "build": "webpack" }, "author": "", "license": "Mozilla Public License Version 2.0", "dependencies": { "webpack": "^1.13.1", "typescript": "^1.8.10" }, "devDependencies": { "css-loader": "^0.23.1", "style-loader": "^0.13.1", "webpack-dev-server": "^1.14.1" } } WebPack.config.js module.exports = { entry: { entry:"./src/entry.js" }, output: […]

无法使用webpack dev服务器中间件加载图像

所以我花了24小时来调整我的代码,试图让这个工作和searchSO和谷歌,但没有运气 – 也许有人可以帮助! 我的React应用程序在Express上运行,但是使用webpack-dev-server中间件。 当我加载页面时,图像是空白的,就好像它们不存在一样。 我没有得到任何错误信息在我的控制台(例如没有404错误),但图像元素只是显示alt文本,并没有显示实际应该在那里的png或svg 。 顺便说一句,这不仅仅是反应组件不能渲染图像 – 我试图将一个图像文件硬编码到我的index.html文件中作为测​​试,这产生了相同的结果。 这是我的代码: server.js(截断以排除数据库设置和额外的快速路由) const express = require('express'); const webpack = require('webpack'); const webpackDevMiddleware = require('webpack-dev-middleware'); const webpackHotMiddleware = require('webpack-hot-middleware'); const path = require('path'); const mongoose = require('mongoose'); const config = require('./webpack.dev.config'); // SERVER SETUP const app = express(); const router = express.Router(); var publicPath = path.resolve(__dirname, […]

Webpack在JS文件中引发一个奇怪的语法错误

我有一个简单的文件结构为我的JS文件: bundle.js src | — main.js — forms | — forms.js 我的main.js文件如下所示: let forms = require('./forms/forms'); forms.js文件如下所示: export default class Forms { test = () => { alert('Forms.test() executed!'); } } var forms = new Forms(); forms.test(); 这会引发以下错误: Hash: a1ed74e596de181cec27 Version: webpack 1.14.0 Time: 21592ms Asset Size Chunks Chunk Names ./static/js/bundle.js 277 kB 0 [emitted] […]

Webpack 2无法parsingwebpack.config.js中的入口点

尝试通过webpack 2构build应用程序时收到错误消息。 我的应用程序文件夹结构如下所示: / | – dist/ | | – src/ | | | | – modules/ | | | | | | – module1.js | | | | – index.js * | | _ webpack.config.js | | – package.json 我的webpack.config.js文件的相关部分在这里: /** * Requires */ const path = require('path'); /** * Variables */ const PATHS […]