vuesion / vuesion

Vuesion is a boilerplate that empowers product teams to build faster with modern best practices across engineering and design. It features a full-stack framework, comprehensive design system, robust testing, and seamless internationalization.

Home Page:https://vuesion.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Where can I find vue.config.js

mrtinkz opened this issue · comments

Describe the bug
A clear and concise description of what the bug is.
I am trying to address window is not defined in worker file and would need to configure webpack or the vue.config.js as a workaround.
FranckFreiburger/vue-pdf#97

  1. I do not see vue.config.js in the project
  2. When I try to add the below webpack.config.js the application won't start

output: { globalObject: 'this' }
any idea how I could solve this problem, I am new to vue and vuesion.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Hey, you can overwrite the webpack config in this file: https://github.com/vuesion/vuesion/blob/master/.vuesion/webpack.config.js

Did you try ˋconfig.output.globalObject = 'this'ˋ?

Yes I tried the below setting but the app wouldn't start, I am trying to use vue-pdf to display a pdf file also using no-ssr.

const isProd = process.env.NODE_ENV === 'production';

module.exports = (config, target) => {
  if (target === 'client' && isProd) {
    config.performance = {
      hints: 'warning',
      maxEntrypointSize: 400000,
      maxAssetSize: 300000,
    };
  }
  config.output.globalObject = 'this';
  
  return config;
};
:~/Workspace/vuesion$ npm run dev

> vuesion@3.7.2 dev /home/Workspace/vuesion
> vuesion dev -o

Start development mode...
Exit with error code: 1

Trace:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vuesion@3.7.2 dev: `vuesion dev -o`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vuesion@3.7.2 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/.npm/_logs/2020-02-01T22_03_25_213Z-debug.log

debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm@6.13.7
3 info using node@v12.14.1
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle vuesion@3.7.2~predev: vuesion@3.7.2
6 info lifecycle vuesion@3.7.2~dev: vuesion@3.7.2
7 verbose lifecycle vuesion@3.7.2~dev: unsafe-perm in lifecycle true
8 verbose lifecycle vuesion@3.7.2~dev: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/Workspace/vuesion/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle vuesion@3.7.2~dev: CWD: /home/Workspace/vuesion
10 silly lifecycle vuesion@3.7.2~dev: Args: [ '-c', 'vuesion dev -o' ]
11 silly lifecycle vuesion@3.7.2~dev: Returned: code: 1  signal: null
12 info lifecycle vuesion@3.7.2~dev: Failed to exec dev script
13 verbose stack Error: vuesion@3.7.2 dev: `vuesion dev -o`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:223:5)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:223:5)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid vuesion@3.7.2
15 verbose cwd /home/Workspace/vuesion
16 verbose Linux 5.3.0-28-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
18 verbose node v12.14.1
19 verbose npm  v6.13.7
20 error code ELIFECYCLE
21 error errno 1
22 error vuesion@3.7.2 dev: `vuesion dev -o`
22 error Exit status 1
23 error Failed at the vuesion@3.7.2 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

if you only need it on the client-side I would recommend to only use the component there: you can use this technique: https://vuesion.github.io/docs/en/tutorials/third-party.html#vue-components-based-on-jquery-plugins

in your case it would be something like:

const pdf = CLIENT ? require('vue-pdf').default : null;

...

    components: {
      pdf,
      ...
    }

...

if you want to know more about the underlying issue you can run npm run dev -- --debug, that'll show you more information about the webpack issue.

let me know if this works for you.

I guess the problem is something else, I pretty much removed pdf vue dependencies and I am not using it anymore. But making any change to the webpack.config.js breaks the application and I couldn't run anymore.

You should be able to replicate it by just checking out code fresh and making change to webpack.config.js the application wouldn't run and --debug does not give any extra information.

config.output.globalObject = 'this'

@mrtinkz can i close this issue?

I'll close this issue.