not sure if this is by design but this code:
import file from './file';
export default [file];
gives this error:
Error: /file/index.js:1
(function (exports, require, module, __filename, __dirname) { import file from './file';
^^^^^^
SyntaxError: Unexpected token import
but this works great!
const file = require('./file');
module.exports = [file];
At the bottom of this doc, it says putting a file within a src
subdir will allow you to write es6. (https://www.gatsbyjs.org/docs/plugin-authoring/#local-plugins)
Is this by design or maybe I'm missing something?
you can place the files in a src subfolder and build them to the plugin folder root
You need a build step as the last part of that sentence describes. Node.js won't support import/export until Node 10 and only then in .mjs files.
Most helpful comment
You need a build step as the last part of that sentence describes. Node.js won't support import/export until Node 10 and only then in .mjs files.