Repository: parcel-bundler/parcel
File: packages/transformers/vue/src/VueTransformer.js (JavaScript)

Code before:
            case 'less':
              toInstall = 'less';
              break;
            case 'stylus':
            case 'styl':
              toInstall = 'stylus';
              break;
            case 'scss':
            case 'sass':
              toInstall = 'sass';
              break;
            case 'css':
            case undefined:
              break;
            default:
              throw new ThrowableDiagnostic({
                diagnostic: {
                  message: `Unknown style language: "${style.lang}"`,
                  origin: '@parcel/transformer-vue',
                  filePath: asset.filePath,
                },
              });
          }
          if (options.autoinstall && toInstall) {
            await options.packageManager.require(toInstall, asset.filePath, {
              autoinstall: true,
            });
          }
          let styleComp = await compiler.compileStyleAsync({
            filename: asset.filePath,
            source: style.content,
            modules: style.module,
            preprocessLang: style.lang || 'css',
            scoped: style.scoped,
            map: style.src ? undefined : style.map,
            id: scopeId,
          });
          if (styleComp.errors.length) {
            throw new ThrowableDiagnostic({
              diagnostic: styleComp.errors.map(err => {
                return createDiagnostic(err, asset.filePath);
              }),
            });
          }
          let styleAsset = {
            type: 'css',
            content: styleComp.code,
            sideEffects: !style.module,
            ...(!style.src &&
              options.sourceMaps && {map: createMap(style.map)}),
            uniqueKey: asset.id + '-style' + i,

Review comment (bug):
If you remove `options.autoinstall from the condition` and the value directly to the package manager, an error would be thrown.

I'm guessing `compileStyleAsync` fails as well when the package is missing?

Code after:
            case 'less':
              toInstall = 'less';
              break;
            case 'stylus':
            case 'styl':
              toInstall = 'stylus';
              break;
            case 'scss':
            case 'sass':
              toInstall = 'sass';
              break;
            case 'css':
            case undefined:
              break;
            default:
              throw new ThrowableDiagnostic({
                diagnostic: {
                  message: `Unknown style language: "${style.lang}"`,
                  origin: '@parcel/transformer-vue',
                  filePath: asset.filePath,
                },
              });
          }
          if (toInstall) {
            await options.packageManager.require(toInstall, asset.filePath, {
              autoinstall: options.autoinstall,
            });
          }
          let styleComp = await compiler.compileStyleAsync({
            filename: asset.filePath,
            source: style.content,
            modules: style.module,
            preprocessLang: style.lang || 'css',
            scoped: style.scoped,
            map: style.src ? undefined : style.map,
            id: scopeId,
          });
          if (styleComp.errors.length) {
            throw new ThrowableDiagnostic({
              diagnostic: styleComp.errors.map(err => {
                return createDiagnostic(err, asset.filePath);
              }),
            });
          }
          let styleAsset = {
            type: 'css',
            content: styleComp.code,
            sideEffects: !style.module,
            ...(!style.src &&
              options.sourceMaps && {map: createMap(style.map)}),
            uniqueKey: asset.id + '-style' + i,