webpack-splitchunks

How to config webpack - libraryTarget + splitChunks to import chunks in another project

不打扰是莪最后的温柔 提交于 2020-01-25 10:13:41
问题 I have a similar question to How to config webpack - libraryTarget + splitChunks + requaire in borwser. I wrote an npm plugin and compile it by webpack. Next, I installed it in the Nuxt project and add an import to this npm plugin in (for example) index.vue. Plugin src files look like import 'fetch'; export class Tools... etc. If I don't use splitChunks all works fine ( import { Tools } from 'libs/dist/.../tools' ), but with splitChunks I have undefined/1/end loop loading Nuxt app/empty model

How to separate a specified file using webpack in vue-cli project

ⅰ亾dé卋堺 提交于 2019-12-25 18:50:57
问题 I have a config file (config.js), which depends on two files: local.js(for development environment) and deploy.js(for production environment). After run serve or run build , it will create some configurations rely on the environment. I used it like the following: <template> </template> <script> import config from '@/assets/scripts/config.js' export default { data() { return { apiBasePath: config.apiBasePath } } } </script> My config.js: import local from '../../../config/local' import deploy

Webpack v4 creating tiny chunks (by route)

做~自己de王妃 提交于 2019-12-22 10:07:22
问题 This is some of the code I'm using in my React app. My routes are written using react-router-config which allows me to keep a centralized way so I know where to go always in order to modify or add some. const routes = [ { component: Root, routes: [ { path: "/", exact: true, component: Home }, { path: "/child/:id", component: Child, routes: [ { path: "/child/:id/grand-child", component: GrandChild } ] } ] } ]; Then, let's say the Child component is dinamically imported: const Child = lazy(() =