webpack-dev-server

React, WebPack and Babel for Internet Explorer 10 and below produces SCRIPT1002: Syntax error

*爱你&永不变心* 提交于 2019-12-31 00:56:28
问题 I've read multiple threads regarding similar issues and tried some propositions, but had no results. I've followed few tutorials related to React.js and WebPack 3 . As the result the application is working well on all browsers (at this moment) except IE 10 and below. The error points to bundle.js (once I'm using the configuration Nr.1): SCRIPT1002: Syntax error and the line - const url = __webpack_require__(83); With configuration Nr2., on local server - : SCRIPT1002: Syntax error - line with

Webpack with bower support

冷暖自知 提交于 2019-12-30 18:56:11
问题 Would I like to load preferably the node packages, and only if not exist, loads the bower package. I would just use the node package only as recommended in Webpack site, but I need to load a library that is just in bower, https://github.com/Stamplay/stamplay-js-sdk and https://github.com/Stamplay/angular-stamplay Try with bower-webpack-plugin I installed https://github.com/lpiepiora/bower-webpack-plugin But when I run webpack-dev-server -d --watch the error is displayed in chrome console:

nodejs服务实现反向代理,解决本地开发接口请求跨域问题

蓝咒 提交于 2019-12-29 00:43:21
前后端分离项目需要解决第一个问题就是,前端本地开发时如何解决通过ajax请求产生的跨域的问题。一般的做法是通过本地配置nginx反向代理进行处理的,除此之外,还可以通过nodejs来进行代理接口。当然,要实现这个前提是,前端开发环境必须运行在nodejs服务中,所幸的是,现在前端的开发自动化工具都是建立在nodejs上的,所以这个前提也不是很重要。 webpack-dev-server配置跨域方案 如果你项目是用webpack作为前端自动化构建工具的话,那么可以引用webpack-dev-server来进行配置跨域方案。webpack-dev-server是一个小型的nodejs服务器,是基于express框架的,用于实时监听和打包编译静态资源。其中里面有一个属性是proxy,是专门来配置代理请求接口的。 举个例子: 比如我现在通过webpack构建了一个本地开发环境,端口号是9000,现在我要在本地去请求(GET) http://jsonplaceholder.typicode.com/users 地址获取数据,如果前端没有设置代理的话,请求会因为跨域请求失败。这时候通过如下配置,就可以正常请求了。 devServer: { contentBase: __dirname + "/", port: 9000, proxy: { "/users": { //需要代理的路径

Webpack构建Vue项目(非Vuecli)

天大地大妈咪最大 提交于 2019-12-27 18:20:11
我们平时构建Vue项目,经常是用Vue官方提供的Vue-Cli脚手架,搭建起来非常方便。而Cli是基于webpack的工具,这里我要直接用webpack来搭建一个vue项目。 前提 请确保安装了 Node.js 的最新版本,Node-v查看版本号 开始构建项目 创建项目目录(myVuecli) 生成package.json npm init 在项目中安装webpack npm install --save-dev webpack (如果你使用 webpack 4+ 版本)在项目中安装 webpack-cli npm install --save-dev webpack 创建 src 目录(存放打包前源文件) src 中创建 index.html src 中创建 main.js(主入口文件) src 中创建 components (components 存放 vue 组件) src中创建App.vue文件 在根路径中创建 webpack.config.js 6.安装依赖 npm install --save vue npm install --save vue-router npm install --save-dev webpack-dev-server npm install --save-dev babel-core babel-loader@7.1.5 babel

How to include a CSS from bower_components using webpack dev server?

∥☆過路亽.° 提交于 2019-12-25 09:29:39
问题 I am loading a fe library using bower which is situated in folder bower_components . In public folder I have an html page which should contain a reference to the fe library. Using the following code I get 404 when loading owfont-regular.css How to load the css file correctly in webpack dev server? <body> <div id="root"></div> <script src="/assets/bundle.js"></script> <link href="/assets/bower_components/owfont/css/owfont-regular.css" rel="stylesheet" type="text/css"> </body> const path =

Webpack Entry module not found (by tutorial)

假如想象 提交于 2019-12-25 09:01:38
问题 Found this tutorial (linked to last page) on codeacademy, decided to try this modern-way of deploying and configuring js apps (decided to try ReactJS ) Step by step implemented it just like it was told, but I edened up with this error (when I try to build everything) ERROR in Entry module not found: Error: Can't resolve 'C:\Users\temp1\Documents\Learn\ReactJS\playaroundapp\index.html' in 'C:\Users\temp1\Documents\Learn\ReactJS\playaround' resolve 'C:\Users\temp1\Documents\Learn\ReactJS

webpack-dev-server doesn't watch/recompile files if they import named exports

不打扰是莪最后的温柔 提交于 2019-12-25 09:01:10
问题 Problem This is the craziest webpack issue I ever saw. You don't want to know the amount of time debugging took to find the problem. I have a pretty basic webpack.config.js : const path = require('path'); const webpack = require('webpack'); module.exports = { entry: path.resolve(__dirname, 'app/index.js'), output: { path: path.join(__dirname, 'build'), filename: 'boundle.js', }, module: { rules: [ { test: /\.jsx?$/, use: [ 'babel-loader', ], exclude: /node_modules/ }, ], }, plugins: [ new

How to use autoprefixer with Webpack 1.x.x?

£可爱£侵袭症+ 提交于 2019-12-25 08:28:35
问题 I'm writing an Angular 1.5.x app with components that embed their own style. The <leave-calendar> component define a linear-gradient background which works fine on Firefox but need the vendor prefix in Chromium. Here is what I have done so far: Requirements a working component ; installed postcss-loader : yarn add --dev postcss-loader add browserslist to package.json : "browserslist": [ "> 1%", "last 2 versions", "ie 9" ] leave-calendar.html <style lang="scss"> .leave-draft { background-color

webpack dev server port

馋奶兔 提交于 2019-12-25 08:00:06
问题 I need to change which port webpack-dev-server listen to. Up to now, I've created these there files: webpack.common.js webpack.dev.js webpack.prod.js 回答1: If you have not created a package.json file it will be good if you make one and have a code block like this: { "name": "someName", "description": "description", "main": "index.js", "scripts": { "start": "webpack-dev-server --host 0.0.0.0 --port 8080 --devtool eval --progress --colors", "build": "NODE_ENV=production webpack --config webpack

Can't use vue component in my Rails5 app

倾然丶 夕夏残阳落幕 提交于 2019-12-25 01:05:05
问题 I'm new to vue.js and webpack configuration. I can use Vue instance in app/javascript/packs/somecode.js . But I can't render *.vue file. If I add any *.vue file to app/javascript/packs/components/ directory, it says "module build failed: ReferenceError: [BABEL] A common cause of this error is the presence of a configuration options object without the corresponding preset name. ". But I didnt create any new option. environment ruby ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin16]