adambullmer / vue-cli-plugin-browser-extension

Browser extension development plugin for vue-cli 3.0
GNU Lesser General Public License v3.0
426 stars 76 forks source link

Yarn build error contenthash:8 not implemented in this context #75

Open jschatz1 opened 4 years ago

jschatz1 commented 4 years ago

yarn build was working for me, but it stopped working just today for some reason. I am getting the following error:


 error

Cannot convert undefined or null to object

 error  in css/[name].[contenthash:8].css

Path variable [contenthash:8] not implemented in this context: css/[name].[contenthash:8].css

 ERROR  Build failed with errors.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I don't know if this is in your plugin or vue-cli or where the problem is.

jschatz1 commented 4 years ago

I got it working, but I don't know what I did. I just switched a few branches and it worked again.

adambullmer commented 4 years ago

did you happen to adjust the NODE_ENV environment variable, or --mode flag? Another option is having .env files in the root of your repo that specify a NODE_ENV. I'm just guessing as to what might have caused that for you

jschatz1 commented 4 years ago

I don't think so. I just run yarn build. It is happening again for me with my latest yarn build. I can't see to get rid of this time.

jschatz1 commented 4 years ago

AFAICT I am using your package and Vue CLI 3 without any extra customization.

jschatz1 commented 4 years ago

Also I found out that if I set filenameHashing: false it works. If I leave the filenameHashing default it fails.

jschatz1 commented 4 years ago

I narrowed it down to one line. Which I removed and everything works. There's something wrong with dynamic importing and I don't know if it's this library or vue cli 3. I updated to the latest vue cli 3 which is 3.12.1 and everything is building fine.

This is the line:

import( /*webpackChunkName: "papaparse"*/  "papaparse").then(m => {

If I remove the dynamic import and just import the file with

import papa from "papaparse";

Everything works fine.

adambullmer commented 4 years ago

Are you able to push your project/branch up to where I can see it? I tried recreating the conditions locally with the import splitting hint and was not able to reproduce it. Could you also include:

Name Version
vue-cli-plugin-browser-extension
Operating System
Node
NPM/Yarn
vue-cli
vue-cli-service

If you are unable to share a repository link, then a package.json, vue.config.js and a contrived example would be the next best thing.