草庐IT

gulp-webpack

全部标签

javascript - 如何调试 Gulp 任务?

如何使用诸如GoogleChrome调试器之类的调试器来调试在我的gulpfile.js中定义的gulp任务,逐行执行任务的代码? 最佳答案 使用Node.js6.3+版本,您可以使用--inspectflag运行任务时。调试名为css的gulp任务:找出你的gulp可执行文件在哪里。如果gulp安装在本地,它将位于node_modules/.bin/gulp。如果gulp已全局安装,请在终端中运行whichgulp(Linux/Mac)或wheregulp(Windows)以找到它。根据您的Node.js版本运行这些命令之一。如果

node.js - 在 nodejs 的服务器端使用 webpack

我一直在尝试将webpack与nodejs应用程序一起使用,并且客户端运行良好-他们网站上有相当不错的文档+来自谷歌搜索的链接。有人在nodejs的服务器端使用过webpack吗?或者请引导我到任何有用的链接。谢谢。 最佳答案 这可能有用:http://jlongster.com/Backend-Apps-with-Webpack--Part-I关键是在webpack配置文件中将所有第三方模块(在node_modules目录中)外部化最终配置文件varwebpack=require('webpack');varpath=requir

javascript - webpack 循环导入返回空对象

目前正遇到这个确切的问题:FileA:varb=requirefileBvarc=requirefileCFileB:vara=requirefileAFileC:vara=requirefileA当我运行代码时,文件C中出现错误:A.doSomethingisnotafunction在那里扔了一个调试器,发现A是一个空对象。真正奇怪的是,我只在文件C中收到错误,而不是在文件B中。这里super困惑。 最佳答案 这不是webpack的问题,而是CommonJS模块的属性。当第一次需要一个CommonJS模块时,它的exports属性

javascript - 如何使用 gulp-uglify 缩小 ES6 函数?

当我运行gulp时,我收到以下错误:[12:54:14]{[GulpUglifyError:unabletominifyJavaScript]cause:{[SyntaxError:Unexpectedtoken:operator(>)]message:'Unexpectedtoken:operator(>)',filename:'bundle.js',line:3284,col:46,pos:126739},plugin:'gulp-uglify',fileName:'C:\\servers\\vagrant\\workspace\\awesome\\web\\tool\\bundl

node.js - 错误 : Cannot find module 'webpack/lib/node/NodeTemplatePlugin'

运行webpack后出现此错误。Webpack已全局安装,我正在运行NodePSD:\Projects\ng2-admin-master>ngserveCannotfindmodule'webpack/lib/node/NodeTemplatePlugin'Error:Cannotfindmodule'webpack/lib/node/NodeTemplatePlugin'atFunction.Module._resolveFilename(module.js:469:15)atFunction.Module._load(module.js:417:25)atModule.requir

node.js - webpack-dev-server 找不到模块 'webpack'

我正在尝试使用webpack-dev-server来运行一个简单的程序但我收到了这个错误:module.js:471throwerr;^Error:Cannotfindmodule'webpack'atFunction.Module._resolveFilename(module.js:469:15)atFunction.Module._load(module.js:417:25)atModule.require(module.js:497:17)atrequire(internal/module.js:20:19)atObject.atModule._compile(module.j

javascript - 如何使用 webpack 在 js 文件中加载 CDN 或外部 vendor javascript lib,而不是在 html 文件中

我正在使用react入门套件进行客户端编程。它使用react和webpack。没有index.html或任何要编辑的html,所有js文件。我的问题是,如果我想从云端加载vendorjslib,我该怎么做?在html文件中很容易做到这一点。但是,在js文件中,它只使用npm安装的包。如何在没有html文件的情况下导入上述库?我试过import和require,它们只适用于本地文件。2015年10月21日更新到目前为止,我尝试了两个方向,都不理想。@minheq是的,有一个用于响应启动工具包的html文件。它是src/components/Html下的html.js。我可以像这样将云库及

javascript - 我可以使用具有多个源和多个目标的 Gulp 任务吗?

我的gulpfile.js中有以下内容:varsass_paths=['./httpdocs-site1/media/sass/**/*.scss','./httpdocs-site2/media/sass/**/*.scss','./httpdocs-site3/media/sass/**/*.scss'];gulp.task('sass',function(){returngulp.src(sass_paths).pipe(sass({errLogToConsole:true})).pipe(autoprefixer('last4version')).pipe(minifyCSS(

node.js - gulp-sass,当属性名称无效时 watch 停止

出现错误消息时watch停止。stream.js:94thrower;//Unhandledstreamerrorinpipe.^sourcestring:51:error:invalidpropertyname如何让watch保持运行,并告诉我错误在哪里。grunt可以处理错误,不需要停止,styleSheet.scss:41:error:invalidpropertyname否则,当出现错误时,我需要在命令行中继续输入“gulp”。 最佳答案 已附加此答案以反射(reflect)Gulp的最新更改。为了与OPs问题相关,我保留了

node.js - Webpack 4 - 创建 vendor block

在webpack3配置中,我将使用以下代码创建单独的vendor.jsblock:entry:{client:['./client.js'],vendor:['babel-polyfill','react','react-dom','redux'],},output:{filename:'[name].[chunkhash].bundle.js',path:'../dist',chunkFilename:'[name].[chunkhash].bundle.js',publicPath:'/',},plugins:[newwebpack.HashedModuleIdsPlugin(),