Webpack

Set correct path to lazy-load component using Webpack - ES6

∥☆過路亽.° 提交于 2021-02-08 08:32:29
问题 In my app.js file I have the following event inside a function where I import another module (same as in the docs) using the lazy-loading technique: button.onclick = e => import(/* webpackChunkName: "print" */ './print').then(module => { var print = module.default; print(); }); And in my webpack config I set up this (besides Babel, SASS loaders, etc): const path = require('path'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); const UglifyJsPlugin = require('uglifyjs-webpack

Set correct path to lazy-load component using Webpack - ES6

a 夏天 提交于 2021-02-08 08:32:04
问题 In my app.js file I have the following event inside a function where I import another module (same as in the docs) using the lazy-loading technique: button.onclick = e => import(/* webpackChunkName: "print" */ './print').then(module => { var print = module.default; print(); }); And in my webpack config I set up this (besides Babel, SASS loaders, etc): const path = require('path'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); const UglifyJsPlugin = require('uglifyjs-webpack

React-table css not loading is webpack the issue?

风格不统一 提交于 2021-02-08 08:23:27
问题 I'm not too familiar with webpack but I think it's causing a problem. I'm using a react boilerplate and have installed react-table as a dependancy. Added the code and all is displaying but the css is not. If anyone can point me in the right direction I would be very grateful! This is how I added it to my component import ReactTable from 'react-table'; import 'react-table/react-table.css'; In my render, I'm doing the following <ReactTable noDataText="No data available" data={this.state.rows}

Vue.js using local javascript file functions in component: Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_0__.writeSomething is not a function

你离开我真会死。 提交于 2021-02-08 06:47:48
问题 I am trying to import a local JS file into a single file component in a Vue application. My application is a scaffold generated by vue-CLI (ver 3.8.2). Here are my relevant code snippets (all other code in application is unchanged from generated code): /path/to/app-vue/src/components/HelloWorld.vue <template> <div class="hello"> <Module1/> </div> </template> <script lang="ts"> import { Component, Prop, Vue } from 'vue-property-decorator'; import Module1 from './Module1.vue'; @Component({

Wepback. Loading chunk failed after using `import()`

坚强是说给别人听的谎言 提交于 2021-02-08 05:00:23
问题 I'm working on React project and I had found out that one of budles files is too big and I need to split it. So, I tried to use import() sintax: import React from 'react'; import thumbnails from './thumbnails.json'; export default class Portfolio extends React.Component { constructor(props) { super(props); import('react-image-gallery').then(module => { const ImageGallery = module.default; this.galleries = thumbnails.map((thumbnail, i) => { let items = []; for (let i = 0; i < thumbnail.gallery

How to override Bootstrap variables in Vue workflow ( Vanilla Bootstrap )?

こ雲淡風輕ζ 提交于 2021-02-08 04:39:46
问题 The officially recommended way to customize / theme bootstrap is by overriding the bootstrap variables using sass. But how do I do this, or rather, how do I add this part of the process into the Vue webpack workflow ? Googling led to try editing the vue.config.js file to add scss loader into webpack but I am unable to find the required file. This is the directory structure I have used vue-cli v3.4 to setup the project. I am using vanilla bootstrap and not the bootstrap-vue components. 回答1:

Webpack devserver with Nginx and Docker: polling info on the wrong address

被刻印的时光 ゝ 提交于 2021-02-08 03:40:44
问题 I have 2 containers in Docker: Node.js + Webpack devserver which listen on port 3000 Nginx which listen on port 80 (mapped on host port 8080 through docker-compose file) Nginx correctly proxy requests to the node container and I can access the node app at http://localhost:8080, but for some reasons there are other polling requests of the type http://localhost:3000/sockjs-node/info?t=1570780621084 that fail (net::ERR_CONNECTION_REFUSED) because on the host only Nginx on port 8080 is visible. I

How to organize node,js/webpack project with server, client, and shared code?

岁酱吖の 提交于 2021-02-08 02:10:52
问题 This seems like a situation that must be incredibly common, but I've yet to find a good solution to it. I'm a little new to modern Javascript, so please forgive me (or better yet, correct me) if I'm using the wrong terminology here and there. I'm developing a web application. It's got a server, running as Javascript (ES6, I believe - using import/export) in node.js, using express.js for a router (and built by express-cli). And it's got a client side, also Javascript, mostly Vue modules (and

How to organize node,js/webpack project with server, client, and shared code?

一笑奈何 提交于 2021-02-08 02:03:14
问题 This seems like a situation that must be incredibly common, but I've yet to find a good solution to it. I'm a little new to modern Javascript, so please forgive me (or better yet, correct me) if I'm using the wrong terminology here and there. I'm developing a web application. It's got a server, running as Javascript (ES6, I believe - using import/export) in node.js, using express.js for a router (and built by express-cli). And it's got a client side, also Javascript, mostly Vue modules (and

Webpack SASS-loader include statement breaks SASS @import statemetns

ぐ巨炮叔叔 提交于 2021-02-07 20:47:37
问题 So for background originally I was excluding the node_modules directory in my Webpack config, which was working fine for my sass @import statements, but made it very difficult to include things from the node_modules directory. So I switched the SASS loader to the following { test: /\.scss$/, include: [path.resolve(__dirname, "/src/client"), path.resolve(__dirname, "/node_modules/angular-material/")], loader: 'style-loader!css-loader!autoprefixer-loader!sass-loader' }, Please also note I tried