question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

errored on @vue/cli 4.2.3

See original GitHub issue

Environment

Vuejs: ^2.6.11 Vue CLI: 4.2.3 Yarn: v1.22.4

Installed packages

Description

After adding to existing vue project the plugin via vue add @fullhuman/purgecss and configuring the file vue.config.js with following content

const purgecss = require("@fullhuman/vue-cli-plugin-purgecss")

module.exports = {
    runtimeCompiler: false,
    productionSourceMap: false,
    pages: {
        index: {
            // entry for the page
            entry: 'src/main.js',
            // the source template
            template: 'public/index.html',
            // output as dist/index.html
            filename: 'index.html',
            // when using title option,
            // template title tag needs to be <title><%= htmlWebpackPlugin.options.title %></title>
            title: 'Title',
            // chunks to include on this page, by default includes
            // extracted common chunks and vendor chunks.
            chunks: []
        }
    },
    configureWebpack: config => {
        if (process.env.NODE_ENV === 'production') {
            config.plugins.push(
                purgecss({
                    content: [
                        './public/**/*.html',
                        "./src/**/*.vue"
                    ],
                    defaultExtractor(content) {
                        const contentWithoutStyleBlocks = content.replace(/<style[^]+?<\/style>/gi, '')
                        return contentWithoutStyleBlocks.match(/[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g) || []
                    },
                    whitelist: ["html", "body"],
                    whitelistPatternsChildren: [/^token/, /^pre/, /^code/],
                })
            );
        }
    }
}

I execute vue-cli-service build and I get the following error:

yarn run v1.22.4
$ vue-cli-service build
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '@fullhuman/vue-cli-plugin-purgecss'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at idToPlugin (/projects/template/node_modules/@vue/cli-service/lib/Service.js:160:14)
    at Object.keys.concat.filter.map.id (/projects/template/node_modules/@vue/cli-service/lib/Service.js:199:20)
    at Array.map (<anonymous>)
    at Service.resolvePlugins (/projects/template/node_modules/@vue/cli-service/lib/Service.js:185:10)
    at new Service (/projects/template/node_modules/@vue/cli-service/lib/Service.js:47:25)
    at Object.<anonymous> (/projects/template/node_modules/@vue/cli-service/bin/vue-cli-service.js:15:17)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What am I missing?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:15
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
Fflorielcommented, Apr 20, 2020

It looks like new versions of vue-cli are acting like vue-cli-plugin-purgecss is a vue-cli service. And so is trying to fetch it when building. I don’t see a solution to this issue on this end.

I’ll look at the vue-cli repository and add an issue to see it is or not an issue with vue-cli.

2reactions
bosemiancommented, Apr 13, 2020

I’m waiting the solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue CLI: Home
Create, develop and manage your projects through an accompanying graphical user interface. Future Ready. Effortlessly ship native ES2015 code for modern ...
Read more >
Problem in creating new project
Vue CLI v4.2.3 ✨ Creating project in E:\VueProjects\vue-app. Initializing git repository... ⚙️ Installing CLI plugins. This might take a while... npm ...
Read more >
NPM: npm peer dependency conflict - vue.js
While resolving: admin-gateway@0.0.1 npm ERR! Found: rxjs@7.3.0 npm ERR! node_modules/rxjs npm ERR! rxjs@"^6.0.0" from the root project npm ERR ...
Read more >
@vue/cli - npm
Command line interface for rapid Vue.js development. Latest version: 5.0.8, last published: 2 months ago. Start using @vue/cli in your ...
Read more >
Vue: Deploy failed because of "npm run build" not working?
Hi there, I'm currently working on a Vue app and to check if everything's ... 12:12:41 PM: ERR! enoent This is related to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found