Hello,
Bulma/JS newbie here... trying to build a simple site the "npm way", starting with bulma-start and adding a bulma-extension component. I doubt this a bulma-extension issue, and since bulma-start seems newbie-oriented, I figured I should start here :)
Steps to reproduce issue:
Copied contents of bulma-start (including dot files) into project directory. From project dir:
npm install
npm start
Browse to index.html... Great! "Hello Bulma" is up and running...
Now, let's add a bulma-extension:
npm install bulma-carousel
Then, according to instructions, import the module in _sass/main.sass (first line):
import bulmaCarousel from '/node_modules/bulma-carousel/dist/bulma-carousel.min.js';
I have also tried installing/importing bulma-calendar. Both extensions result in the same error from browser console:
ReferenceError: require is not defined.
I can see that there is, indeed, a require() call being compiled into lib/main.js by Babel for the imported bulma extension.
Some researching leads me to think this might have to do with Babel, babel-preset-env, and babel-preset-es2015-ie. Found this https://www.npmjs.com/package/babel-plugin-add-module-exports but following the instructions there did not help. Also read that maybe webpack or browserify could address this, but seems a little excessive... I will keep trying to adjust Babel and see what happens.
Any ideas what I could be doing wrong? Maybe .babelrc needs modification?
Hello, Bulma/JS newbie here... trying to build a simple site the "npm way", starting with bulma-start and adding a bulma-extension component. I doubt this a bulma-extension issue, and since bulma-start seems newbie-oriented, I figured I should start here :)
Steps to reproduce issue:
npm install
npm start
Browse to index.html... Great! "Hello Bulma" is up and running... Now, let's add a bulma-extension:
npm install bulma-carousel
import bulmaCarousel from '/node_modules/bulma-carousel/dist/bulma-carousel.min.js';
I have also tried installing/importing bulma-calendar. Both extensions result in the same error from browser console:
ReferenceError: require is not defined
.I can see that there is, indeed, a require() call being compiled into lib/main.js by Babel for the imported bulma extension.
Some researching leads me to think this might have to do with Babel, babel-preset-env, and babel-preset-es2015-ie. Found this https://www.npmjs.com/package/babel-plugin-add-module-exports but following the instructions there did not help. Also read that maybe webpack or browserify could address this, but seems a little excessive... I will keep trying to adjust Babel and see what happens.
Any ideas what I could be doing wrong? Maybe .babelrc needs modification?