Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing gray-matter dependency in @vuepress/shared-utils #1190

Closed
1 task done
jdoubleu opened this issue Jan 13, 2019 · 2 comments
Closed
1 task done

Missing gray-matter dependency in @vuepress/shared-utils #1190

jdoubleu opened this issue Jan 13, 2019 · 2 comments

Comments

@jdoubleu
Copy link

jdoubleu commented Jan 13, 2019

  • I confirm that this is a issue rather than a question.

Bug report

I am using the @vuepress/markdown-loader package in another project.
This package requires @vuepress/shared-utils.

The parseFrontmatter.ts file requires the gray-matter module which is not present in the package.json of @vuepress/shared-utils.

Version

$ npm list | grep -2  @vuepress/markdown-loader
└─┬ @vuepress/[email protected]
  ├─┬ @vuepress/[email protected]
  │ ├─┬ @vuepress/[email protected]

Steps to reproduce

  1. Create a package that requires @vuepress/markdown-loader (e.g. npm install @vuepress/markdown-loader)
  2. Install webpack: npm install webpack webpack-cli
  3. Add a Markdown file (e.g. Example.md)
  4. Configure webpack to use the markdown file as entry and the the markdown-loader to compile it:
const path = require('path')

module.exports = {
    entry: path.resolve(__dirname, 'Example.md'),
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'file.js'
    },
    module: {
        rules: [
            {
                test: /\.md$/,
                use: [
                    {
                        loader: require.resolve('@vuepress/markdown-loader'),
                        options: {
                            sourceDir: path.resolve('chapters')
                        }
                    }
                ]
            }
        ]
    }
}
  1. Run webpack

What is expected?

The markdown loader compiles all Markdown files.

What is actually happening?

Webpack throws the following warnings:

WARNING in ./Example.md
Module build failed (from ../@vuepress/markdown-loader/index.js):
Error: Cannot find module 'gray-matter'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:657:17)
    at require (/path/to/project/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at parseFrontmatter (/path/to/project/node_modules/@vuepress/shared-utils/lib/parseFrontmatter.js:2:18)
    at Object.module.exports (/path/to/project/node_modules/@vuepress/markdown-loader/index.js:41:23)
 @ ./ sync nonrecursive \.md$ ./Example.md
 @ ./index.js

Other relevant information

  • Your OS: macOS
  • Node.js version: v11.6.0
  • Browser version: n/a
  • Is this a global or local install? local
  • Which package manager did you use for the install? npm
@ulivz ulivz closed this as completed in 02bf7b9 Jan 15, 2019
@jdoubleu
Copy link
Author

Seems like semver is missing, too.

...
Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:657:17)
    at require (/path/to/project/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/path/to/project/node_modules/@vuepress/shared-utils/lib/module.js:3:16)
...

(cc @ulivz )

@ulivz
Copy link
Member

ulivz commented Jan 17, 2019

@jdoubleu Thanks, fixed at 1161507, it will be out at next alpha version, for now you can install it temporarily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants