You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, thanks for this plugin. I don't know why, but with this line on my webpack.config: import SitemapPlugin from 'sitemap-webpack-plugin';
I got a lot of errors like this:
import SitemapPlugin from 'sitemap-webpack-plugin';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at requireConfig
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webpack-starter@1.0.0 dev: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webpack-starter@1.0.0 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! /Users/lmuzquiz/.npm/_logs/2017-07-14T22_23_30_638Z-debug.log
So i had to use the following to make it work:
const SitemapPlugin = require('sitemap-webpack-plugin').default;
Im using webpack 3 and node 8
The text was updated successfully, but these errors were encountered:
lmuzquiz
changed the title
Add require option to documentation instead of
Add require option to documentation maybe?
Jul 14, 2017
lmuzquiz
changed the title
Add require option to documentation maybe?
Add require option to documentation in addition to import
Jul 14, 2017
Hi. Your error is just because import/export are not yet supported in Node.js absent babel (here's some further reading if you're interested in the implementation complexities). You could use babel for your webpack config to support import syntax as is used in the example. I don't really think this is worth separately documenting for this plugin though -- it's dependent on how you write your webpack config (with/without babel) and presumably the end user is already aware of how they're loading modules; and it's an option related to module loading in general, nothing specific to this plugin.
Hello, thanks for this plugin. I don't know why, but with this line on my webpack.config:
import SitemapPlugin from 'sitemap-webpack-plugin';
I got a lot of errors like this:
So i had to use the following to make it work:
const SitemapPlugin = require('sitemap-webpack-plugin').default;
Im using webpack 3 and node 8
The text was updated successfully, but these errors were encountered: